import { type SandboxCreateOptions, type SandboxFileInfo, type SandboxInfo, type SandboxStatus, type Execution, type FileToWrite, type SandboxRunOptions, type SandboxRunResult, type ListSandboxesParams, type ListSandboxesResponse, type ListRuntimesParams, type ListRuntimesResponse, type Job, type CreateJobOptions } from './types.ts';
import type { Logger } from '../../logger.ts';
import type { Readable, Writable } from 'node:stream';
import { z } from 'zod';
import { type SandboxPauseResult } from './pause.ts';
import { type ExecutionInfo, type ExecutionListResponse } from './execution.ts';
import { type JobListResponse } from './job.ts';
import { type DiskCheckpointInfo } from './disk-checkpoint.ts';
import { type SnapshotInfo, type SnapshotListResponse, type SnapshotLineageResponse, type SnapshotListParams, type SnapshotLineageParams } from './snapshot.ts';
import { type SandboxEventListResponse } from './events.ts';
/**
 * Extended execute options that support piping output to writable streams
 */
export declare const ExecuteOptionsSchema: z.ZodObject<{
    command: z.ZodArray<z.ZodString>;
    files: z.ZodOptional<z.ZodArray<z.ZodObject<{
        path: z.ZodString;
        content: z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>;
    }, z.core.$strip>>>;
    timeout: z.ZodOptional<z.ZodString>;
    stream: z.ZodOptional<z.ZodObject<{
        stdout: z.ZodOptional<z.ZodString>;
        stderr: z.ZodOptional<z.ZodString>;
        timestamps: z.ZodOptional<z.ZodBoolean>;
    }, z.core.$strip>>;
    signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
    pipe: z.ZodOptional<z.ZodObject<{
        stdout: z.ZodOptional<z.ZodCustom<Writable, Writable>>;
        stderr: z.ZodOptional<z.ZodCustom<Writable, Writable>>;
    }, z.core.$strip>>;
}, z.core.$strip>;
export type ExecuteOptions = z.infer<typeof ExecuteOptionsSchema>;
export declare const SandboxClientOptionsSchema: z.ZodObject<{
    apiKey: z.ZodOptional<z.ZodString>;
    url: z.ZodOptional<z.ZodString>;
    orgId: z.ZodOptional<z.ZodString>;
    logger: z.ZodOptional<z.ZodCustom<Logger, Logger>>;
}, z.core.$strip>;
export type SandboxClientOptions = z.infer<typeof SandboxClientOptionsSchema>;
/**
 * I/O options for one-shot sandbox execution via run()
 */
export declare const SandboxClientRunIOSchema: z.ZodObject<{
    signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
    stdin: z.ZodOptional<z.ZodCustom<Readable, Readable>>;
    stdout: z.ZodOptional<z.ZodCustom<Writable, Writable>>;
    stderr: z.ZodOptional<z.ZodCustom<Writable, Writable>>;
    logger: z.ZodOptional<z.ZodCustom<Logger, Logger>>;
}, z.core.$strip>;
export type SandboxClientRunIO = z.infer<typeof SandboxClientRunIOSchema>;
/**
 * A sandbox instance returned by SandboxClient.create() or SandboxClient.connect()
 */
export interface SandboxInstance {
    /**
     * Unique sandbox identifier
     */
    id: string;
    /**
     * Sandbox status at creation or connection time
     */
    status: SandboxStatus;
    /**
     * URL to stream stdout output
     */
    stdoutStreamUrl?: string;
    /**
     * URL to stream stderr output
     */
    stderrStreamUrl?: string;
    /**
     * URL to stream audit events (eBPF/Tetragon security events)
     */
    auditStreamUrl?: string;
    /**
     * Execute a command in the sandbox
     */
    execute(options: ExecuteOptions): Promise<Execution>;
    /**
     * Write files to the sandbox workspace
     */
    writeFiles(files: FileToWrite[]): Promise<number>;
    /**
     * Read a file from the sandbox workspace
     */
    readFile(path: string): Promise<ReadableStream<Uint8Array>>;
    /**
     * List files in the sandbox workspace
     */
    listFiles(path?: string): Promise<SandboxFileInfo[]>;
    /**
     * Create a directory in the sandbox workspace
     */
    mkDir(path: string, recursive?: boolean): Promise<void>;
    /**
     * Remove a file from the sandbox workspace.
     * @returns Object with `found` indicating whether the file existed before removal
     */
    rmFile(path: string): Promise<{
        found: boolean;
    }>;
    /**
     * Remove a directory from the sandbox workspace.
     * @returns Object with `found` indicating whether the directory existed before removal
     */
    rmDir(path: string, recursive?: boolean): Promise<{
        found: boolean;
    }>;
    /**
     * Set environment variables on the sandbox. Pass null to delete a variable.
     */
    setEnv(env: Record<string, string | null>): Promise<Record<string, string>>;
    /**
     * Get current sandbox information
     */
    get(): Promise<SandboxInfo>;
    /**
     * Pause the sandbox, creating a checkpoint of its current state
     */
    pause(): Promise<SandboxPauseResult>;
    /**
     * Resume the sandbox from a paused or evacuated state
     */
    resume(): Promise<void>;
    /**
     * Destroy the sandbox and release all resources
     */
    destroy(): Promise<void>;
}
/**
 * A job instance returned by SandboxClient.createJob() or SandboxClient.getJob()
 */
export interface JobInstance {
    /**
     * Unique job identifier
     */
    readonly id: string;
    /**
     * ID of the sandbox this job belongs to
     */
    readonly sandboxId: string;
    /**
     * Current job status
     */
    readonly status: string;
    /**
     * Get the current job status and details
     */
    get(): Promise<Job>;
    /**
     * Stop the job
     * @param force - Force termination with SIGKILL
     */
    stop(force?: boolean): Promise<Job>;
}
/**
 * A disk checkpoint instance returned by SandboxClient.createDiskCheckpoint() or SandboxClient.getDiskCheckpoint()
 */
export interface DiskCheckpointInstance {
    /**
     * Unique checkpoint identifier
     */
    readonly id: string;
    /**
     * User-provided checkpoint name
     */
    readonly name: string;
    /**
     * ID of the sandbox this checkpoint belongs to
     */
    readonly sandboxId: string;
    /**
     * ISO timestamp of creation
     */
    readonly createdAt: string;
    /**
     * Parent checkpoint name
     */
    readonly parent: string;
    /**
     * Restore the sandbox to this checkpoint
     */
    restore(): Promise<void>;
    /**
     * Delete this checkpoint
     */
    delete(): Promise<void>;
}
/**
 * Convenience client for sandbox operations.
 *
 * @example
 * ```typescript
 * // Interactive sandbox usage
 * const client = new SandboxClient();
 * const sandbox = await client.create();
 * const result = await sandbox.execute({ command: ['echo', 'hello'] });
 * await sandbox.destroy();
 *
 * // One-shot execution with streaming
 * const result = await client.run(
 *   { command: { exec: ['bun', 'run', 'script.ts'] } },
 *   { stdout: process.stdout, stderr: process.stderr }
 * );
 * ```
 */
export declare class SandboxClient {
    #private;
    constructor(options?: SandboxClientOptions);
    /**
     * Run a one-shot command in a new sandbox (creates, executes, destroys)
     *
     * This is a high-level convenience method that handles the full lifecycle:
     * creating a sandbox, streaming I/O, polling for completion, and cleanup.
     *
     * @param options - Execution options including command and configuration
     * @param io - Optional I/O streams and abort signal
     * @returns The run result including exit code and duration
     * @throws {Error} If stdin is provided without an API key
     *
     * @example
     * ```typescript
     * const client = new SandboxClient();
     * const result = await client.run(
     *   { command: { exec: ['bun', 'run', 'script.ts'] } },
     *   { stdout: process.stdout, stderr: process.stderr }
     * );
     * console.log('Exit code:', result.exitCode);
     * ```
     */
    run(options: SandboxRunOptions, io?: SandboxClientRunIO): Promise<SandboxRunResult>;
    /**
     * Create a new sandbox instance
     *
     * @param options - Optional sandbox configuration
     * @returns A sandbox instance with execute and destroy methods
     */
    create(options?: SandboxCreateOptions): Promise<SandboxInstance>;
    /**
     * Get sandbox information by ID
     *
     * @param sandboxId - The sandbox ID
     * @returns Sandbox information
     */
    get(sandboxId: string): Promise<SandboxInfo>;
    /**
     * Destroy a sandbox by ID
     *
     * @param sandboxId - The sandbox ID to destroy
     */
    destroy(sandboxId: string): Promise<void>;
    /**
     * Write files to a sandbox workspace
     *
     * @param sandboxId - The sandbox ID
     * @param files - Array of files to write with path and content
     * @param signal - Optional AbortSignal to cancel the operation
     * @returns The number of files written
     */
    writeFiles(sandboxId: string, files: FileToWrite[], signal?: AbortSignal): Promise<number>;
    /**
     * Read a file from a sandbox workspace
     *
     * @param sandboxId - The sandbox ID
     * @param path - Path to the file relative to the sandbox workspace
     * @param signal - Optional AbortSignal to cancel the operation
     * @returns A ReadableStream of the file contents
     */
    readFile(sandboxId: string, path: string, signal?: AbortSignal): Promise<ReadableStream<Uint8Array>>;
    /**
     * Get a full sandbox instance for an existing sandbox by ID.
     *
     * Unlike `get()` which returns read-only metadata, `connect()` returns
     * a `SandboxInstance` with `execute()`, `writeFiles()`, and all other
     * interaction methods — allowing you to resume working with a sandbox
     * using just its ID.
     *
     * @param sandboxId - The sandbox ID to connect to
     * @returns A sandbox instance with all interaction methods
     */
    connect(sandboxId: string): Promise<SandboxInstance>;
    /**
     * Pause a running sandbox, creating a checkpoint of its current state
     *
     * @param sandboxId - The sandbox ID to pause
     */
    pause(sandboxId: string): Promise<SandboxPauseResult>;
    /**
     * Resume a paused or evacuated sandbox from its checkpoint
     *
     * @param sandboxId - The sandbox ID to resume
     */
    resume(sandboxId: string): Promise<void>;
    /**
     * List all sandboxes with optional filtering and pagination
     *
     * @param params - Optional parameters for filtering by project, status, and pagination
     * @returns Paginated list of sandboxes with total count
     */
    list(params?: ListSandboxesParams): Promise<ListSandboxesResponse>;
    /**
     * List available sandbox runtimes
     *
     * @param params - Optional parameters for pagination
     * @returns List of runtimes with total count
     */
    listRuntimes(params?: ListRuntimesParams): Promise<ListRuntimesResponse>;
    /**
     * Create a new job in a sandbox
     *
     * @param sandboxId - The sandbox ID where the job should run
     * @param options - Job creation options including command
     * @returns A job instance with get() and stop() methods
     */
    createJob(sandboxId: string, options: CreateJobOptions): Promise<JobInstance>;
    /**
     * Get a job instance by ID
     *
     * @param sandboxId - The sandbox ID
     * @param jobId - The job ID
     * @returns A job instance with get() and stop() methods
     */
    getJob(sandboxId: string, jobId: string): Promise<JobInstance>;
    /**
     * List all jobs in a sandbox
     *
     * @param sandboxId - The sandbox ID
     * @param limit - Maximum number of results
     * @returns List of jobs
     */
    listJobs(sandboxId: string, limit?: number): Promise<JobListResponse>;
    /**
     * Create a disk checkpoint of a sandbox
     *
     * @param sandboxId - The sandbox ID
     * @param name - Name for the checkpoint
     * @returns A checkpoint instance with restore() and delete() methods
     */
    createDiskCheckpoint(sandboxId: string, name: string): Promise<DiskCheckpointInstance>;
    /**
     * List all disk checkpoints for a sandbox
     *
     * @param sandboxId - The sandbox ID
     * @returns List of checkpoint info objects
     */
    listDiskCheckpoints(sandboxId: string): Promise<DiskCheckpointInfo[]>;
    /**
     * Get a disk checkpoint instance by ID
     *
     * @param sandboxId - The sandbox ID
     * @param checkpointId - The checkpoint ID
     * @returns A checkpoint instance with restore() and delete() methods
     */
    getDiskCheckpoint(sandboxId: string, checkpointId: string): Promise<DiskCheckpointInstance>;
    /**
     * Create a snapshot of a sandbox
     *
     * @param sandboxId - The sandbox ID to snapshot
     * @param params - Optional snapshot parameters (name, tag, public, etc.)
     * @returns The created snapshot information
     */
    createSnapshot(sandboxId: string, params?: {
        name?: string;
        description?: string;
        tag?: string;
        public?: boolean;
    }): Promise<SnapshotInfo>;
    /**
     * Get snapshot information by ID
     *
     * @param snapshotId - The snapshot ID
     * @returns Snapshot information
     */
    getSnapshot(snapshotId: string): Promise<SnapshotInfo>;
    /**
     * List snapshots with optional filtering and pagination
     *
     * @param params - Optional parameters for filtering and pagination
     * @returns Paginated list of snapshots
     */
    listSnapshots(params?: SnapshotListParams): Promise<SnapshotListResponse>;
    /**
     * Delete a snapshot
     *
     * @param snapshotId - The snapshot ID to delete
     */
    deleteSnapshot(snapshotId: string): Promise<void>;
    /**
     * Update the tag on a snapshot
     *
     * @param snapshotId - The snapshot ID
     * @param tag - New tag (or null to remove)
     * @returns Updated snapshot information
     */
    tagSnapshot(snapshotId: string, tag: string | null): Promise<SnapshotInfo>;
    /**
     * Get the lineage (ancestry chain) of a snapshot
     *
     * @param params - Parameters specifying which snapshot to get lineage for
     * @returns Ordered list of snapshots in the lineage
     */
    getSnapshotLineage(params?: SnapshotLineageParams): Promise<SnapshotLineageResponse>;
    /**
     * Get execution information by ID
     *
     * @param executionId - The execution ID
     * @param wait - Optional wait duration for long-polling (e.g., "5m")
     * @returns Execution information
     */
    getExecution(executionId: string, wait?: string): Promise<ExecutionInfo>;
    /**
     * List executions for a sandbox
     *
     * @param sandboxId - The sandbox ID
     * @param limit - Maximum number of results
     * @returns List of executions
     */
    listExecutions(sandboxId: string, limit?: number): Promise<ExecutionListResponse>;
    /**
     * List events for a sandbox
     *
     * @param sandboxId - The sandbox ID
     * @param params - Optional parameters for limit and sort direction
     * @returns List of sandbox events
     */
    listEvents(sandboxId: string, params?: {
        limit?: number;
        direction?: 'asc' | 'desc';
    }): Promise<SandboxEventListResponse>;
}
//# sourceMappingURL=client.d.ts.map