import { BaseClient, Parsed, RequestParams } from "./base-client.js";
import { CommandData, CommandFinishedData, CommandFinishedResponse, CommandResponse, CreateSnapshotResponse, InteractiveSessionResponse, LogOutputLine, SessionResponse, SnapshotResponse, StopSessionResponse } from "./validators.js";
import { FileWriter } from "./file-writer.js";
import { NetworkPolicy } from "../network-policy.js";
import { WithPrivate } from "../utils/types.js";
import { RUNTIMES } from "../constants.js";
import { z } from "#compiled/zod/index.js";
import { Readable } from "stream";

//#region src/api-client/api-client.d.ts
interface WithFetchOptions {
  fetch?: typeof globalThis.fetch;
}
declare class APIClient extends BaseClient {
  private teamId;
  private projectId;
  private isJwtToken;
  constructor(params: {
    baseUrl?: string;
    teamId: string;
    token: string;
    fetch?: typeof globalThis.fetch;
  });
  private ensureValidToken;
  protected request(path: string, params?: RequestParams): Promise<Response>;
  getSession(params: WithPrivate<{
    sessionId: string;
    signal?: AbortSignal;
  }>): Promise<Parsed<{
    session: {
      [x: string]: unknown;
      id: string;
      memory: number;
      vcpus: number;
      region: string;
      runtime: string;
      timeout: number;
      status: "pending" | "running" | "stopping" | "stopped" | "failed" | "aborted" | "snapshotting";
      requestedAt: number;
      createdAt: number;
      cwd: string;
      updatedAt: number;
      startedAt?: number | undefined;
      requestedStopAt?: number | undefined;
      stoppedAt?: number | undefined;
      abortedAt?: number | undefined;
      duration?: number | undefined;
      sourceSnapshotId?: string | undefined;
      snapshottedAt?: number | undefined;
      interactivePort?: number | undefined;
      networkPolicy?: {
        [x: string]: unknown;
        mode: "allow-all";
      } | {
        [x: string]: unknown;
        mode: "deny-all";
      } | {
        [x: string]: unknown;
        mode: "custom";
        allowedDomains?: string[] | undefined;
        allowedCIDRs?: string[] | undefined;
        deniedCIDRs?: string[] | undefined;
        injectionRules?: {
          domain: string;
          headers?: Record<string, string> | undefined;
          headerNames?: string[] | undefined;
          match?: {
            path?: {
              exact?: string | undefined;
              startsWith?: string | undefined;
              regex?: string | undefined;
            } | undefined;
            method?: string[] | undefined;
            queryString?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
            headers?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
          } | undefined;
        }[] | undefined;
        forwardRules?: {
          domain: string;
          forwardURL: string;
          match?: {
            path?: {
              exact?: string | undefined;
              startsWith?: string | undefined;
              regex?: string | undefined;
            } | undefined;
            method?: string[] | undefined;
            queryString?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
            headers?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
          } | undefined;
        }[] | undefined;
      } | undefined;
      activeCpuDurationMs?: number | undefined;
      networkTransfer?: {
        ingress: number;
        egress: number;
      } | undefined;
    };
    routes: {
      url: string;
      subdomain: string;
      port: number;
    }[];
  }>>;
  createSandbox(params: WithPrivate<{
    name?: string;
    ports?: number[];
    projectId: string;
    source?: {
      type: "git";
      url: string;
      depth?: number;
      revision?: string;
      username?: string;
      password?: string;
    } | {
      type: "tarball";
      url: string;
    } | {
      type: "snapshot";
      snapshotId: string;
    };
    timeout?: number;
    resources?: {
      vcpus: number;
    };
    persistent?: boolean;
    runtime?: RUNTIMES | (string & {});
    image?: string;
    networkPolicy?: NetworkPolicy;
    env?: Record<string, string>;
    tags?: Record<string, string>;
    snapshotExpiration?: number;
    keepLastSnapshots?: {
      count: number;
      expiration?: number;
      deleteEvicted?: boolean;
    };
    signal?: AbortSignal;
  }>): Promise<Parsed<{
    sandbox: {
      name: string;
      persistent: boolean;
      createdAt: number;
      updatedAt: number;
      currentSessionId: string;
      status: "pending" | "running" | "stopping" | "stopped" | "failed" | "aborted" | "snapshotting";
      region?: string | undefined;
      vcpus?: number | undefined;
      memory?: number | undefined;
      runtime?: string | undefined;
      timeout?: number | undefined;
      networkPolicy?: {
        [x: string]: unknown;
        mode: "allow-all";
      } | {
        [x: string]: unknown;
        mode: "deny-all";
      } | {
        [x: string]: unknown;
        mode: "custom";
        allowedDomains?: string[] | undefined;
        allowedCIDRs?: string[] | undefined;
        deniedCIDRs?: string[] | undefined;
        injectionRules?: {
          domain: string;
          headers?: Record<string, string> | undefined;
          headerNames?: string[] | undefined;
          match?: {
            path?: {
              exact?: string | undefined;
              startsWith?: string | undefined;
              regex?: string | undefined;
            } | undefined;
            method?: string[] | undefined;
            queryString?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
            headers?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
          } | undefined;
        }[] | undefined;
        forwardRules?: {
          domain: string;
          forwardURL: string;
          match?: {
            path?: {
              exact?: string | undefined;
              startsWith?: string | undefined;
              regex?: string | undefined;
            } | undefined;
            method?: string[] | undefined;
            queryString?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
            headers?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
          } | undefined;
        }[] | undefined;
      } | undefined;
      totalEgressBytes?: number | undefined;
      totalIngressBytes?: number | undefined;
      totalActiveCpuDurationMs?: number | undefined;
      totalDurationMs?: number | undefined;
      currentSnapshotId?: string | undefined;
      statusUpdatedAt?: number | undefined;
      cwd?: string | undefined;
      tags?: Record<string, string> | undefined;
      snapshotExpiration?: number | undefined;
      keepLastSnapshots?: {
        count: number;
        expiration?: number | undefined;
        deleteEvicted?: boolean | undefined;
      } | undefined;
    };
    session: {
      [x: string]: unknown;
      id: string;
      memory: number;
      vcpus: number;
      region: string;
      runtime: string;
      timeout: number;
      status: "pending" | "running" | "stopping" | "stopped" | "failed" | "aborted" | "snapshotting";
      requestedAt: number;
      createdAt: number;
      cwd: string;
      updatedAt: number;
      startedAt?: number | undefined;
      requestedStopAt?: number | undefined;
      stoppedAt?: number | undefined;
      abortedAt?: number | undefined;
      duration?: number | undefined;
      sourceSnapshotId?: string | undefined;
      snapshottedAt?: number | undefined;
      interactivePort?: number | undefined;
      networkPolicy?: {
        [x: string]: unknown;
        mode: "allow-all";
      } | {
        [x: string]: unknown;
        mode: "deny-all";
      } | {
        [x: string]: unknown;
        mode: "custom";
        allowedDomains?: string[] | undefined;
        allowedCIDRs?: string[] | undefined;
        deniedCIDRs?: string[] | undefined;
        injectionRules?: {
          domain: string;
          headers?: Record<string, string> | undefined;
          headerNames?: string[] | undefined;
          match?: {
            path?: {
              exact?: string | undefined;
              startsWith?: string | undefined;
              regex?: string | undefined;
            } | undefined;
            method?: string[] | undefined;
            queryString?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
            headers?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
          } | undefined;
        }[] | undefined;
        forwardRules?: {
          domain: string;
          forwardURL: string;
          match?: {
            path?: {
              exact?: string | undefined;
              startsWith?: string | undefined;
              regex?: string | undefined;
            } | undefined;
            method?: string[] | undefined;
            queryString?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
            headers?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
          } | undefined;
        }[] | undefined;
      } | undefined;
      activeCpuDurationMs?: number | undefined;
      networkTransfer?: {
        ingress: number;
        egress: number;
      } | undefined;
    };
    routes: {
      url: string;
      subdomain: string;
      port: number;
    }[];
    resumed?: boolean | undefined;
  }>>;
  runCommand(params: {
    sessionId: string;
    cwd?: string;
    command: string;
    args: string[];
    env: Record<string, string>;
    sudo: boolean;
    wait: true;
    logs?: boolean;
    onLog?: (log: LogOutputLine) => void;
    timeout?: number;
    signal?: AbortSignal;
  }): Promise<{
    command: CommandData;
    finished: Promise<CommandFinishedData>;
  }>;
  runCommand(params: {
    sessionId: string;
    cwd?: string;
    command: string;
    args: string[];
    env: Record<string, string>;
    sudo: boolean;
    wait?: false;
    timeout?: number;
    signal?: AbortSignal;
  }): Promise<Parsed<z.infer<typeof CommandResponse>>>;
  getCommand(params: {
    sessionId: string;
    cmdId: string;
    wait: true;
    signal?: AbortSignal;
  }): Promise<Parsed<z.infer<typeof CommandFinishedResponse>>>;
  getCommand(params: {
    sessionId: string;
    cmdId: string;
    wait?: boolean;
    signal?: AbortSignal;
  }): Promise<Parsed<z.infer<typeof CommandResponse>>>;
  openInteractive(params: {
    sessionId: string;
    signal?: AbortSignal;
  }): Promise<Parsed<z.infer<typeof InteractiveSessionResponse>>>;
  mkDir(params: {
    sessionId: string;
    path: string;
    cwd?: string;
    signal?: AbortSignal;
  }): Promise<Parsed<Record<string, never>>>;
  getFileWriter(params: {
    sessionId: string;
    extractDir: string;
    signal?: AbortSignal;
  }): {
    response: Promise<Response>;
    writer: FileWriter;
  };
  listSessions(params: {
    /**
     * The ID or name of the project to which the sessions belong.
     * @example "my-project"
     */
    projectId: string;
    /**
     * Filter sessions by sandbox name.
     */
    name?: string;
    /**
     * Maximum number of sessions to list from a request.
     * @example 10
     */
    limit?: number;
    /**
     * Cursor for pagination.
     */
    cursor?: string;
    /**
     * Sort order for results.
     */
    sortOrder?: "asc" | "desc";
    signal?: AbortSignal;
  }): Promise<Parsed<{
    sessions: {
      [x: string]: unknown;
      id: string;
      memory: number;
      vcpus: number;
      region: string;
      runtime: string;
      timeout: number;
      status: "pending" | "running" | "stopping" | "stopped" | "failed" | "aborted" | "snapshotting";
      requestedAt: number;
      createdAt: number;
      cwd: string;
      updatedAt: number;
      startedAt?: number | undefined;
      requestedStopAt?: number | undefined;
      stoppedAt?: number | undefined;
      abortedAt?: number | undefined;
      duration?: number | undefined;
      sourceSnapshotId?: string | undefined;
      snapshottedAt?: number | undefined;
      interactivePort?: number | undefined;
      networkPolicy?: {
        [x: string]: unknown;
        mode: "allow-all";
      } | {
        [x: string]: unknown;
        mode: "deny-all";
      } | {
        [x: string]: unknown;
        mode: "custom";
        allowedDomains?: string[] | undefined;
        allowedCIDRs?: string[] | undefined;
        deniedCIDRs?: string[] | undefined;
        injectionRules?: {
          domain: string;
          headers?: Record<string, string> | undefined;
          headerNames?: string[] | undefined;
          match?: {
            path?: {
              exact?: string | undefined;
              startsWith?: string | undefined;
              regex?: string | undefined;
            } | undefined;
            method?: string[] | undefined;
            queryString?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
            headers?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
          } | undefined;
        }[] | undefined;
        forwardRules?: {
          domain: string;
          forwardURL: string;
          match?: {
            path?: {
              exact?: string | undefined;
              startsWith?: string | undefined;
              regex?: string | undefined;
            } | undefined;
            method?: string[] | undefined;
            queryString?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
            headers?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
          } | undefined;
        }[] | undefined;
      } | undefined;
      activeCpuDurationMs?: number | undefined;
      networkTransfer?: {
        ingress: number;
        egress: number;
      } | undefined;
    }[];
    pagination: {
      count: number;
      next: string | null;
    };
  }>>;
  listSnapshots(params: {
    /**
     * The ID or name of the project to which the snapshots belong.
     * @example "my-project"
     */
    projectId: string;
    /**
     * Filter snapshots by sandbox name.
     */
    name?: string;
    /**
     * Maximum number of snapshots to list from a request.
     * @example 10
     */
    limit?: number;
    /**
     * Cursor for pagination.
     */
    cursor?: string;
    /**
     * Sort order for results.
     */
    sortOrder?: "asc" | "desc";
    signal?: AbortSignal;
  }): Promise<Parsed<{
    snapshots: {
      id: string;
      sourceSessionId: string;
      region: string;
      status: "failed" | "created" | "deleted";
      sizeBytes: number;
      createdAt: number;
      updatedAt: number;
      expiresAt?: number | undefined;
      lastUsedAt?: number | undefined;
      creationMethod?: string | undefined;
      parentId?: string | undefined;
    }[];
    pagination: {
      count: number;
      next: string | null;
    };
  }>>;
  getSnapshotTree(params: {
    /**
     * The ID or name of the project to which the snapshots belong.
     */
    projectId: string;
    /**
     * The snapshot ID to use as the anchor for the tree traversal.
     */
    snapshotId: string;
    /**
     * Maximum number of nodes to return.
     */
    limit?: number;
    /**
     * Sort order: "asc" for descendants, "desc" for ancestors.
     */
    sortOrder?: "asc" | "desc";
    signal?: AbortSignal;
  }): Promise<Parsed<{
    snapshots: {
      snapshot: {
        id: string;
        sourceSessionId: string;
        region: string;
        status: "failed" | "created" | "deleted";
        sizeBytes: number;
        createdAt: number;
        updatedAt: number;
        expiresAt?: number | undefined;
        lastUsedAt?: number | undefined;
        creationMethod?: string | undefined;
        parentId?: string | undefined;
      };
      siblings: {
        id: string;
        sourceSessionId: string;
        region: string;
        status: "failed" | "created" | "deleted";
        sizeBytes: number;
        createdAt: number;
        updatedAt: number;
        expiresAt?: number | undefined;
        lastUsedAt?: number | undefined;
        creationMethod?: string | undefined;
        parentId?: string | undefined;
      }[];
      count: string;
    }[];
    pagination: {
      count: number;
      next: string | null;
    };
    anchor?: {
      snapshot: {
        id: string;
        sourceSessionId: string;
        region: string;
        status: "failed" | "created" | "deleted";
        sizeBytes: number;
        createdAt: number;
        updatedAt: number;
        expiresAt?: number | undefined;
        lastUsedAt?: number | undefined;
        creationMethod?: string | undefined;
        parentId?: string | undefined;
      };
      siblings: {
        id: string;
        sourceSessionId: string;
        region: string;
        status: "failed" | "created" | "deleted";
        sizeBytes: number;
        createdAt: number;
        updatedAt: number;
        expiresAt?: number | undefined;
        lastUsedAt?: number | undefined;
        creationMethod?: string | undefined;
        parentId?: string | undefined;
      }[];
      count: string;
    } | undefined;
  }>>;
  writeFiles(params: {
    sessionId: string;
    cwd: string;
    files: {
      path: string;
      content: string | Uint8Array;
      mode?: number;
    }[];
    extractDir: string;
    signal?: AbortSignal;
  }): Promise<void>;
  readFile(params: {
    sessionId: string;
    path: string;
    cwd?: string;
    signal?: AbortSignal;
  }): Promise<Readable | null>;
  killCommand(params: {
    sessionId: string;
    commandId: string;
    signal: number;
    abortSignal?: AbortSignal;
  }): Promise<Parsed<{
    command: {
      id: string;
      name: string;
      args: string[];
      cwd: string;
      sessionId: string;
      exitCode: number | null;
      startedAt: number;
    };
  }>>;
  getLogs(params: {
    sessionId: string;
    cmdId: string;
    signal?: AbortSignal;
  }): AsyncGenerator<LogOutputLine, void, void> & Disposable & {
    close(): void;
  };
  stopSession(params: {
    sessionId: string;
    signal?: AbortSignal;
  }): Promise<Parsed<z.infer<typeof StopSessionResponse>>>;
  updateNetworkPolicy(params: {
    sessionId: string;
    networkPolicy: NetworkPolicy;
    signal?: AbortSignal;
  }): Promise<Parsed<z.infer<typeof SessionResponse>>>;
  extendTimeout(params: {
    sessionId: string;
    duration: number;
    signal?: AbortSignal;
  }): Promise<Parsed<z.infer<typeof SessionResponse>>>;
  createSnapshot(params: {
    sessionId: string;
    expiration?: number;
    signal?: AbortSignal;
  }): Promise<Parsed<z.infer<typeof CreateSnapshotResponse>>>;
  deleteSnapshot(params: {
    snapshotId: string;
    signal?: AbortSignal;
  }): Promise<Parsed<z.infer<typeof SnapshotResponse>>>;
  getSnapshot(params: {
    snapshotId: string;
    signal?: AbortSignal;
  }): Promise<Parsed<z.infer<typeof SnapshotResponse>>>;
  getSandbox(params: WithPrivate<{
    name: string;
    projectId: string;
    resume?: boolean;
    signal?: AbortSignal;
  }>): Promise<Parsed<{
    sandbox: {
      name: string;
      persistent: boolean;
      createdAt: number;
      updatedAt: number;
      currentSessionId: string;
      status: "pending" | "running" | "stopping" | "stopped" | "failed" | "aborted" | "snapshotting";
      region?: string | undefined;
      vcpus?: number | undefined;
      memory?: number | undefined;
      runtime?: string | undefined;
      timeout?: number | undefined;
      networkPolicy?: {
        [x: string]: unknown;
        mode: "allow-all";
      } | {
        [x: string]: unknown;
        mode: "deny-all";
      } | {
        [x: string]: unknown;
        mode: "custom";
        allowedDomains?: string[] | undefined;
        allowedCIDRs?: string[] | undefined;
        deniedCIDRs?: string[] | undefined;
        injectionRules?: {
          domain: string;
          headers?: Record<string, string> | undefined;
          headerNames?: string[] | undefined;
          match?: {
            path?: {
              exact?: string | undefined;
              startsWith?: string | undefined;
              regex?: string | undefined;
            } | undefined;
            method?: string[] | undefined;
            queryString?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
            headers?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
          } | undefined;
        }[] | undefined;
        forwardRules?: {
          domain: string;
          forwardURL: string;
          match?: {
            path?: {
              exact?: string | undefined;
              startsWith?: string | undefined;
              regex?: string | undefined;
            } | undefined;
            method?: string[] | undefined;
            queryString?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
            headers?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
          } | undefined;
        }[] | undefined;
      } | undefined;
      totalEgressBytes?: number | undefined;
      totalIngressBytes?: number | undefined;
      totalActiveCpuDurationMs?: number | undefined;
      totalDurationMs?: number | undefined;
      currentSnapshotId?: string | undefined;
      statusUpdatedAt?: number | undefined;
      cwd?: string | undefined;
      tags?: Record<string, string> | undefined;
      snapshotExpiration?: number | undefined;
      keepLastSnapshots?: {
        count: number;
        expiration?: number | undefined;
        deleteEvicted?: boolean | undefined;
      } | undefined;
    };
    session: {
      [x: string]: unknown;
      id: string;
      memory: number;
      vcpus: number;
      region: string;
      runtime: string;
      timeout: number;
      status: "pending" | "running" | "stopping" | "stopped" | "failed" | "aborted" | "snapshotting";
      requestedAt: number;
      createdAt: number;
      cwd: string;
      updatedAt: number;
      startedAt?: number | undefined;
      requestedStopAt?: number | undefined;
      stoppedAt?: number | undefined;
      abortedAt?: number | undefined;
      duration?: number | undefined;
      sourceSnapshotId?: string | undefined;
      snapshottedAt?: number | undefined;
      interactivePort?: number | undefined;
      networkPolicy?: {
        [x: string]: unknown;
        mode: "allow-all";
      } | {
        [x: string]: unknown;
        mode: "deny-all";
      } | {
        [x: string]: unknown;
        mode: "custom";
        allowedDomains?: string[] | undefined;
        allowedCIDRs?: string[] | undefined;
        deniedCIDRs?: string[] | undefined;
        injectionRules?: {
          domain: string;
          headers?: Record<string, string> | undefined;
          headerNames?: string[] | undefined;
          match?: {
            path?: {
              exact?: string | undefined;
              startsWith?: string | undefined;
              regex?: string | undefined;
            } | undefined;
            method?: string[] | undefined;
            queryString?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
            headers?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
          } | undefined;
        }[] | undefined;
        forwardRules?: {
          domain: string;
          forwardURL: string;
          match?: {
            path?: {
              exact?: string | undefined;
              startsWith?: string | undefined;
              regex?: string | undefined;
            } | undefined;
            method?: string[] | undefined;
            queryString?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
            headers?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
          } | undefined;
        }[] | undefined;
      } | undefined;
      activeCpuDurationMs?: number | undefined;
      networkTransfer?: {
        ingress: number;
        egress: number;
      } | undefined;
    };
    routes: {
      url: string;
      subdomain: string;
      port: number;
    }[];
    resumed?: boolean | undefined;
  }>>;
  listSandboxes(params: {
    projectId: string;
    limit?: number;
    sortBy?: "createdAt" | "name" | "statusUpdatedAt";
    sortOrder?: "asc" | "desc";
    namePrefix?: string;
    cursor?: string;
    tags?: Record<string, string>;
    signal?: AbortSignal;
  }): Promise<Parsed<{
    sandboxes: {
      name: string;
      persistent: boolean;
      createdAt: number;
      updatedAt: number;
      currentSessionId: string;
      status: "pending" | "running" | "stopping" | "stopped" | "failed" | "aborted" | "snapshotting";
      region?: string | undefined;
      vcpus?: number | undefined;
      memory?: number | undefined;
      runtime?: string | undefined;
      timeout?: number | undefined;
      networkPolicy?: {
        [x: string]: unknown;
        mode: "allow-all";
      } | {
        [x: string]: unknown;
        mode: "deny-all";
      } | {
        [x: string]: unknown;
        mode: "custom";
        allowedDomains?: string[] | undefined;
        allowedCIDRs?: string[] | undefined;
        deniedCIDRs?: string[] | undefined;
        injectionRules?: {
          domain: string;
          headers?: Record<string, string> | undefined;
          headerNames?: string[] | undefined;
          match?: {
            path?: {
              exact?: string | undefined;
              startsWith?: string | undefined;
              regex?: string | undefined;
            } | undefined;
            method?: string[] | undefined;
            queryString?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
            headers?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
          } | undefined;
        }[] | undefined;
        forwardRules?: {
          domain: string;
          forwardURL: string;
          match?: {
            path?: {
              exact?: string | undefined;
              startsWith?: string | undefined;
              regex?: string | undefined;
            } | undefined;
            method?: string[] | undefined;
            queryString?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
            headers?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
          } | undefined;
        }[] | undefined;
      } | undefined;
      totalEgressBytes?: number | undefined;
      totalIngressBytes?: number | undefined;
      totalActiveCpuDurationMs?: number | undefined;
      totalDurationMs?: number | undefined;
      currentSnapshotId?: string | undefined;
      statusUpdatedAt?: number | undefined;
      cwd?: string | undefined;
      tags?: Record<string, string> | undefined;
      snapshotExpiration?: number | undefined;
      keepLastSnapshots?: {
        count: number;
        expiration?: number | undefined;
        deleteEvicted?: boolean | undefined;
      } | undefined;
    }[];
    pagination: {
      count: number;
      next: string | null;
    };
  }>>;
  updateSandbox(params: {
    name: string;
    projectId: string;
    persistent?: boolean;
    resources?: {
      vcpus?: number;
      memory?: number;
    };
    runtime?: RUNTIMES | (string & {});
    timeout?: number;
    networkPolicy?: NetworkPolicy;
    tags?: Record<string, string>;
    ports?: number[];
    snapshotExpiration?: number;
    keepLastSnapshots?: {
      count: number;
      expiration?: number;
      deleteEvicted?: boolean;
    } | null;
    currentSnapshotId?: string;
    signal?: AbortSignal;
  }): Promise<Parsed<{
    sandbox: {
      name: string;
      persistent: boolean;
      createdAt: number;
      updatedAt: number;
      currentSessionId: string;
      status: "pending" | "running" | "stopping" | "stopped" | "failed" | "aborted" | "snapshotting";
      region?: string | undefined;
      vcpus?: number | undefined;
      memory?: number | undefined;
      runtime?: string | undefined;
      timeout?: number | undefined;
      networkPolicy?: {
        [x: string]: unknown;
        mode: "allow-all";
      } | {
        [x: string]: unknown;
        mode: "deny-all";
      } | {
        [x: string]: unknown;
        mode: "custom";
        allowedDomains?: string[] | undefined;
        allowedCIDRs?: string[] | undefined;
        deniedCIDRs?: string[] | undefined;
        injectionRules?: {
          domain: string;
          headers?: Record<string, string> | undefined;
          headerNames?: string[] | undefined;
          match?: {
            path?: {
              exact?: string | undefined;
              startsWith?: string | undefined;
              regex?: string | undefined;
            } | undefined;
            method?: string[] | undefined;
            queryString?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
            headers?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
          } | undefined;
        }[] | undefined;
        forwardRules?: {
          domain: string;
          forwardURL: string;
          match?: {
            path?: {
              exact?: string | undefined;
              startsWith?: string | undefined;
              regex?: string | undefined;
            } | undefined;
            method?: string[] | undefined;
            queryString?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
            headers?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
          } | undefined;
        }[] | undefined;
      } | undefined;
      totalEgressBytes?: number | undefined;
      totalIngressBytes?: number | undefined;
      totalActiveCpuDurationMs?: number | undefined;
      totalDurationMs?: number | undefined;
      currentSnapshotId?: string | undefined;
      statusUpdatedAt?: number | undefined;
      cwd?: string | undefined;
      tags?: Record<string, string> | undefined;
      snapshotExpiration?: number | undefined;
      keepLastSnapshots?: {
        count: number;
        expiration?: number | undefined;
        deleteEvicted?: boolean | undefined;
      } | undefined;
    };
    routes?: {
      url: string;
      subdomain: string;
      port: number;
    }[] | undefined;
  }>>;
  deleteSandbox(params: {
    name: string;
    projectId: string;
    signal?: AbortSignal;
  }): Promise<Parsed<{
    sandbox: {
      name: string;
      persistent: boolean;
      createdAt: number;
      updatedAt: number;
      currentSessionId: string;
      status: "pending" | "running" | "stopping" | "stopped" | "failed" | "aborted" | "snapshotting";
      region?: string | undefined;
      vcpus?: number | undefined;
      memory?: number | undefined;
      runtime?: string | undefined;
      timeout?: number | undefined;
      networkPolicy?: {
        [x: string]: unknown;
        mode: "allow-all";
      } | {
        [x: string]: unknown;
        mode: "deny-all";
      } | {
        [x: string]: unknown;
        mode: "custom";
        allowedDomains?: string[] | undefined;
        allowedCIDRs?: string[] | undefined;
        deniedCIDRs?: string[] | undefined;
        injectionRules?: {
          domain: string;
          headers?: Record<string, string> | undefined;
          headerNames?: string[] | undefined;
          match?: {
            path?: {
              exact?: string | undefined;
              startsWith?: string | undefined;
              regex?: string | undefined;
            } | undefined;
            method?: string[] | undefined;
            queryString?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
            headers?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
          } | undefined;
        }[] | undefined;
        forwardRules?: {
          domain: string;
          forwardURL: string;
          match?: {
            path?: {
              exact?: string | undefined;
              startsWith?: string | undefined;
              regex?: string | undefined;
            } | undefined;
            method?: string[] | undefined;
            queryString?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
            headers?: {
              key?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
              value?: {
                exact?: string | undefined;
                startsWith?: string | undefined;
                regex?: string | undefined;
              } | undefined;
            }[] | undefined;
          } | undefined;
        }[] | undefined;
      } | undefined;
      totalEgressBytes?: number | undefined;
      totalIngressBytes?: number | undefined;
      totalActiveCpuDurationMs?: number | undefined;
      totalDurationMs?: number | undefined;
      currentSnapshotId?: string | undefined;
      statusUpdatedAt?: number | undefined;
      cwd?: string | undefined;
      tags?: Record<string, string> | undefined;
      snapshotExpiration?: number | undefined;
      keepLastSnapshots?: {
        count: number;
        expiration?: number | undefined;
        deleteEvicted?: boolean | undefined;
      } | undefined;
    };
    routes?: {
      url: string;
      subdomain: string;
      port: number;
    }[] | undefined;
  }>>;
}
//#endregion
export { APIClient, WithFetchOptions };
//# sourceMappingURL=api-client.d.ts.map