//#region src/public/common.d.ts
type Milliseconds = number;
type Seconds = number;
interface RequestOptions {
  readonly signal?: AbortSignal;
  readonly timeoutMs?: Milliseconds;
}
//#endregion
//#region src/public/commands.d.ts
type Command = readonly [string, ...string[]];
type CommandInputData = string | Uint8Array;
type CommandInput = Command | ReadonlyArray<string>;
type CommandOutputStream = AsyncIterable<string>;
type CommandProcessStatus = "cancelled" | "exited" | "failed" | "running" | "starting";
interface ExecOptions extends RequestOptions {
  readonly check?: boolean;
  readonly cwd?: string;
}
interface StartCommandOptions extends RequestOptions {
  readonly bufferedMaxKiB?: number;
  readonly check?: boolean;
  readonly cwd?: string;
  readonly stdin?: boolean;
}
interface StartCommandOptionsWithStdin extends StartCommandOptions {
  readonly stdin: true;
}
interface ShellOptions extends RequestOptions {
  readonly cols?: number;
  readonly command?: CommandInput;
  readonly rows?: number;
}
interface ProcessResult {
  readonly command: Command;
  readonly exitCode: number;
  readonly failed: boolean;
  readonly ok: boolean;
  readonly stderr: string;
  readonly stderrBytes: Uint8Array;
  readonly stderrBytesProduced: number;
  readonly stderrTruncated: boolean;
  readonly stdout: string;
  readonly stdoutBytes: Uint8Array;
  readonly stdoutBytesProduced: number;
  readonly stdoutTruncated: boolean;
}
interface SandboxCommands {
  run(command: CommandInput, options?: ExecOptions): Promise<ProcessResult>;
  start(command: CommandInput, options: StartCommandOptionsWithStdin): Promise<CommandProcessWithStdin>;
  start(command: CommandInput, options?: StartCommandOptions): Promise<CommandProcess>;
}
interface CommandProcess {
  readonly command: Command;
  readonly exitCode: number | undefined;
  readonly stderr: CommandOutputStream;
  readonly status: CommandProcessStatus;
  readonly stdout: CommandOutputStream;
  cancel(options?: RequestOptions): Promise<void>;
  poll(): number | undefined;
  wait(options?: RequestOptions): Promise<ProcessResult>;
}
interface CommandProcessWithStdin extends CommandProcess {
  readonly stdin: CommandInputWriter;
}
interface CommandInputWriter {
  readonly closed: boolean;
  close(options?: RequestOptions): Promise<void>;
  write(data: CommandInputData, options?: RequestOptions): Promise<void>;
  writeln(text: string, options?: RequestOptions): Promise<void>;
}
interface TerminalResult {
  readonly command: Command;
  readonly exitCode: number;
}
interface TerminalSession {
  readonly command: Command;
  readonly exitCode: number | undefined;
  readonly output: AsyncIterable<Uint8Array>;
  readonly stdin: CommandInputWriter;
  readonly status: CommandProcessStatus;
  cancel(options?: RequestOptions): Promise<void>;
  poll(): number | undefined;
  resize(cols: number, rows: number, options?: RequestOptions): Promise<void>;
  wait(options?: RequestOptions): Promise<TerminalResult>;
}
//#endregion
//#region src/public/data-plane.d.ts
/** Transport policy for exec, logs, and file operations. */
type DataPlaneMode = "auto" | "direct" | "gateway";
interface DataPlaneOptions {
  /**
   * `auto` prefers a sandbox-scoped direct mTLS connection and falls back to
   * the gateway. `direct` requires that connection. Defaults to `auto`.
   */
  readonly dataPlaneMode?: DataPlaneMode;
}
//#endregion
//#region src/public/files.d.ts
type FileContent = string | Uint8Array;
type FileReadResult = Readonly<Record<string, Uint8Array>>;
type FileTextReadResult = Readonly<Record<string, string>>;
type FileWrites = readonly FileWrite[] | Readonly<Record<string, FileContent>>;
type MountedFileContent = string | Uint8Array;
type MountedFiles = readonly MountedFile[] | Readonly<Record<string, MountedFileContent>>;
/** Chunk source for `files.writeStream` (no Web/Node stream types in v1). */
type FileChunkSource = Uint8Array | AsyncIterable<Uint8Array> | Iterable<Uint8Array>;
interface MountedFile {
  readonly content: MountedFileContent;
  readonly path: string;
}
interface FileWrite {
  readonly content: FileContent;
  readonly path: string;
}
interface SandboxFiles {
  read(path: string, options?: RequestOptions): Promise<Uint8Array>;
  read(paths: readonly string[], options?: RequestOptions): Promise<FileReadResult>;
  /**
   * Incrementally read a remote file as binary chunks. Prefer this over
   * buffered `read` for large files. Drain promptly to avoid stream backpressure.
   *
   * `timeoutMs` is one wall-clock budget for the integrity `stat` and the
   * file transfer combined. The clock starts when iteration begins.
   */
  readStream(path: string, options?: RequestOptions): AsyncIterable<Uint8Array>;
  readText(path: string, options?: RequestOptions): Promise<string>;
  readText(paths: readonly string[], options?: RequestOptions): Promise<FileTextReadResult>;
  write(path: string, content: FileContent, options?: RequestOptions): Promise<void>;
  write(files: FileWrites, options?: RequestOptions): Promise<void>;
  /**
   * Incrementally write a remote file from a buffer or chunk iterable.
   * A mid-stream failure or abort may leave a partial remote file.
   */
  writeStream(path: string, source: FileChunkSource, options?: RequestOptions): Promise<void>;
}
//#endregion
//#region src/public/logs.d.ts
type LogStreamMode = "entries" | "lines" | "raw";
interface LogResumeCursor {
  readonly offset: bigint | number | string;
  readonly sessionId: string;
}
interface LogStreamOptions extends RequestOptions {
  readonly follow?: boolean;
  readonly resume?: LogResumeCursor;
  readonly sinceTime?: Date | string;
  readonly tailLines?: number;
  readonly timestamps?: boolean;
}
interface LogReadOptions extends Omit<LogStreamOptions, "follow"> {
  readonly follow?: false;
}
interface SandboxLogs {
  read(options?: LogReadOptions): Promise<string[]>;
  stream(options?: LogStreamOptions): Promise<LogStream>;
  streamEntries(options?: LogStreamOptions): Promise<LogEntryStream>;
  streamRaw(options?: LogStreamOptions): Promise<LogRawStream>;
}
interface LogStream extends AsyncIterable<string> {
  readonly closed: boolean;
  readonly offset: string | undefined;
  readonly sessionId: string | undefined;
  cancel(options?: RequestOptions): Promise<void>;
  close(options?: RequestOptions): Promise<void>;
}
interface LogEntry {
  readonly line: string;
  readonly offset?: string;
  readonly sessionId?: string;
  readonly timestamp?: Date;
}
interface LogEntryStream extends AsyncIterable<LogEntry> {
  readonly closed: boolean;
  readonly offset: string | undefined;
  readonly sessionId: string | undefined;
  cancel(options?: RequestOptions): Promise<void>;
  close(options?: RequestOptions): Promise<void>;
}
interface LogRawChunk {
  readonly data: Uint8Array;
  readonly offset?: string;
  readonly sessionId?: string;
  readonly text: string;
  readonly timestamp?: Date;
}
interface LogRawStream extends AsyncIterable<LogRawChunk> {
  readonly closed: boolean;
  readonly offset: string | undefined;
  readonly sessionId: string | undefined;
  cancel(options?: RequestOptions): Promise<void>;
  close(options?: RequestOptions): Promise<void>;
}
//#endregion
//#region src/public/network.d.ts
type EndpointAuth = "open" | "share_token";
type EndpointKind = "https" | "tls_passthrough";
type ServiceProtocol = "sctp" | "tcp" | "udp";
type ServiceVisibility = "custom" | "private" | "public";
interface HttpsEndpoint {
  readonly auth: EndpointAuth;
  readonly kind: "https";
  /**
   * Server-side HTTPS request clock on this product endpoint (504 while the
   * sandbox stays alive). Not `timeoutMs` on `client.run` / RPCs. Omit or `0`
   * is the platform default (15s on serverless). The SDK only requires an
   * integer; Aviato currently accepts `0` or `[15, 900]`.
   */
  readonly requestTimeoutSeconds?: number;
}
/**
 * TLS passthrough product endpoint. The platform forwards TLS by SNI to the
 * container. `auth` and `requestTimeoutSeconds` must be omitted. The assigned
 * target is `host:port` on `serviceAddresses`. Use the host as TLS SNI. The
 * workload owns certs.
 */
interface TlsPassthroughEndpoint {
  readonly kind: "tls_passthrough";
}
type Endpoint = HttpsEndpoint | TlsPassthroughEndpoint;
interface Service {
  readonly endpoint?: Endpoint;
  readonly name?: string;
  readonly port: number;
  readonly protocol?: ServiceProtocol;
  readonly visibility?: ServiceVisibility;
}
/**
 * One create-time HTTPS (TCP 443) hostname grant.
 *
 * Exact names (`pypi.org`) or a single leftmost wildcard (`*.pypi.org`).
 * `"*"` is a policy ceiling, not a sandbox grant.
 */
interface EgressRule {
  readonly dnsName: string;
}
interface NetworkOptions {
  /**
   * When true, deny outbound traffic. When omitted, the fleet policy default
   * applies — that is not the same as “the internet is allowed”.
   * Mutually exclusive with a non-empty `egress` list.
   */
  readonly denyEgress?: boolean;
  /**
   * When true, deny inbound traffic to CUSTOM-visibility ports. No-op when the
   * sandbox has no CUSTOM ports. Does not hide a public HTTPS endpoint.
   */
  readonly denyIngress?: boolean;
  /**
   * Hostnames the sandbox may reach over HTTPS (TCP 443). Frozen at create.
   * Empty or omitted leaves the fleet policy default. A wildcard is one
   * leftmost label only (`*.pypi.org` does not include apex `pypi.org`).
   */
  readonly egress?: readonly EgressRule[];
}
interface ServiceUrl {
  readonly name: string;
  readonly port: number;
  readonly url: string;
}
/**
 * Applied HTTPS product endpoint echoed on `serviceEndpoints`.
 *
 * Present when proto `requestTimeoutSeconds` is greater than 0. `url` may be
 * `""` when the API suppresses the hostname (for example a terminal Get).
 */
interface HttpsEndpointStatus {
  readonly auth: EndpointAuth;
  readonly kind: "https";
  readonly name: string;
  readonly port: number;
  readonly requestTimeoutSeconds: number;
  readonly url: string;
}
/**
 * Applied TLS passthrough endpoint echoed on `serviceAddresses`.
 *
 * `address` is `host:port`. Use the host as TLS SNI. The workload owns certs.
 */
interface TlsPassthroughEndpointStatus {
  readonly address: string;
  readonly kind: "tls_passthrough";
  readonly name: string;
  readonly port: number;
}
//#endregion
//#region src/public/resources.d.ts
/** CPU and memory only. GPU is not supported on this options type. */
type ResourceOptions = ResourceSpec | ResourceRequestsAndLimits;
interface ResourceSpec {
  readonly cpu?: string;
  readonly memory?: string;
}
interface ResourceRequestsAndLimits {
  readonly limits: ResourceSpec;
  readonly requests: ResourceSpec;
}
//#endregion
//#region src/public/secrets.d.ts
/**
 * A secret reference resolved server-side and injected as an environment variable.
 *
 * Shape matches the Python SDK `Secret` (`store`, `name`, `field`, `env_var`), with
 * camelCase `envVar` for TypeScript. Values are never sent by the client.
 *
 * `store` must match a Gateway-registered secret store name for the organization
 * (for W&B, typically `wandb-team-secrets`). When `envVar` is omitted it defaults
 * to `name`. On the wire, `name` is sent as proto `SecretMapping.path`.
 */
interface SecretInput {
  readonly envVar?: string;
  readonly field?: string;
  readonly name: string;
  readonly store: string;
}
type Secrets = readonly SecretInput[];
//#endregion
//#region src/public/sandbox.d.ts
type EnvironmentVariables = Readonly<Record<string, string>>;
interface FromIdOptions extends RequestOptions, DataPlaneOptions {}
type SandboxAnnotations = Readonly<Record<string, string>>;
type SandboxId = string;
type SandboxTag = string;
type SandboxStatus = "pending" | "creating" | "running" | "paused" | "terminating" | "completed" | "failed" | "terminated" | "unspecified";
/** Document type for `runFromFile`. Compose is pull-only. */
type SandboxFileType = "compose";
/** Filesystem path (`string`) or raw file bytes. A string is always a path. */
type SandboxFileContents = string | Uint8Array;
type WaitTargetStatus = "completed" | "paused" | "running" | "terminal";
interface WaitOptions extends RequestOptions {
  readonly targetStatus?: WaitTargetStatus;
}
type ObjectStoragePermission = "read" | "read-write";
/**
 * Temporary object-storage credentials for the sandbox (OSA / CAIOS).
 * Independent of file-system snapshots.
 */
interface SandboxObjectStorageAccess {
  readonly buckets: readonly string[];
  readonly permission: ObjectStoragePermission;
  /**
   * Optional prefix that scopes the minted credential. Must satisfy Gateway
   * OSA prefix rules when set (alphanumeric start, trailing `/`, no `..`).
   */
  readonly objectPrefix?: string;
}
/**
 * Named scratch volume for snapshot/restore. Prefer `volumes` when the sandbox
 * needs a non-`workspace` name or more than one mount.
 *
 * Snapshots archive these mounts, not the whole container. `snapshot()` cannot
 * choose among multiple scratches created in this process.
 */
interface ScratchVolumeOptions {
  /** Unique name within the sandbox (Gateway: 1-63 `[A-Za-z0-9_-]`). */
  readonly name: string;
  /**
   * Absolute directory to mount (not `/`). Must satisfy Gateway mount-path
   * rules (canonical, ≤256 chars, not a reserved system prefix).
   */
  readonly mountPath: string;
  /** Kubernetes resource quantity (e.g. `"10Gi"`). Omit for the platform default. */
  readonly size?: string;
  /** Restore this snapshot at start. Omit or empty for an empty volume. */
  readonly restoreFromSnapshotId?: string;
}
/**
 * Convenience single-mount scratch volume for snapshot/restore.
 *
 * Maps to a scratch volume named `workspace` mounted at `mountPath` on the
 * primary container. Snapshots archive that mount, not the whole container.
 * Mutually exclusive with `volumes`.
 */
interface FileSystemSnapshotOptions {
  /**
   * Absolute directory to mount (not `/`). Must satisfy Gateway mount-path
   * rules (canonical, ≤256 chars, not a reserved system prefix).
   */
  readonly mountPath: string;
  /** Kubernetes resource quantity (e.g. `"10Gi"`). Omit for the platform default. */
  readonly size?: string;
  /** Restore this snapshot at start. Omit or empty for an empty volume. */
  readonly restoreFromSnapshotId?: string;
}
type FileSystemSnapshotState = "creating" | "ready" | "failed" | "deleting" | "unspecified";
type FileSystemSnapshotTrigger = "unspecified" | "manual" | "on_delete";
/** Org-scoped file-system snapshot record from Get/List, and from `snapshot()` once READY. */
interface FileSystemSnapshotResult {
  readonly snapshotId: string;
  readonly state: FileSystemSnapshotState;
  readonly trigger: FileSystemSnapshotTrigger;
  /** Archive size when Get reports a safe integer; omitted otherwise. */
  readonly sizeBytes?: number;
  readonly stateReason?: string;
  readonly objectBucket?: string;
  readonly sourceSandboxId?: string;
  readonly sourceVolumeName?: string;
  readonly requestId?: string;
  readonly createdAt?: Date;
  readonly updatedAt?: Date;
  readonly completedAt?: Date;
}
interface ListSnapshotsOptions extends RequestOptions {
  /** Client-side filter after a full collect. Not sent on the List RPC. */
  readonly sourceSandboxId?: string;
  /** Client-side filter after a full collect (Python `status`). */
  readonly state?: FileSystemSnapshotState;
}
interface DeleteSnapshotOptions extends RequestOptions {
  /**
   * When true, treat a missing snapshot (gRPC `NOT_FOUND` or trusted
   * `CWSANDBOX_FSS_NOT_FOUND`) as success. Defaults to `false`.
   */
  readonly missingOk?: boolean;
}
interface SandboxRunOptions extends RequestOptions, DataPlaneOptions {
  readonly annotations?: SandboxAnnotations;
  readonly containerImage?: string;
  readonly environmentVariables?: EnvironmentVariables;
  readonly fileSystemSnapshot?: FileSystemSnapshotOptions;
  /**
   * Named scratch volumes. Mutually exclusive with `fileSystemSnapshot`.
   * Must be non-empty. `snapshot()` fails client-side when this process
   * created more than one scratch.
   */
  readonly volumes?: readonly ScratchVolumeOptions[];
  readonly maxLifetimeSeconds?: Seconds;
  readonly mountedFiles?: MountedFiles;
  readonly network?: NetworkOptions;
  readonly objectStorageAccess?: SandboxObjectStorageAccess;
  readonly resources?: ResourceOptions;
  readonly runnerIds?: readonly string[];
  readonly services?: readonly Service[];
  /**
   * Secret-store references to resolve server-side and inject as environment variables.
   *
   * Do not put secret values in `environmentVariables`, annotations, or tags.
   */
  readonly secrets?: Secrets;
  readonly tags?: readonly SandboxTag[];
  /**
   * Wait for the sandbox to reach `running` before resolving creation helpers.
   *
   * Defaults to `true`. Set to `false` only when you need a handle as soon as
   * the backend accepts the start request.
   */
  readonly waitUntilRunning?: boolean;
}
/**
 * Overlays for `runFromTemplate`. Omitted options preserve template values
 * unless `containerImage` is supplied.
 *
 * Replacement is per field, not a merge. Empty top-level maps/lists mean
 * inherit, not clear, except `network: {}`, which replaces the template
 * network. See each property.
 */
interface SandboxRunFromTemplateOptions extends RequestOptions, DataPlaneOptions {
  /**
   * Non-empty input replaces the complete template map; it does not merge
   * keys. Empty `{}` means inherit, not clear.
   */
  readonly annotations?: SandboxAnnotations;
  /**
   * Replaces the complete template container list with one `main` container.
   * All omitted container settings are cleared, including
   * `imagePullCredentials`. A template using private-image credentials works
   * only while its container is inherited unchanged. Replacement credentials
   * are not supported.
   */
  readonly containerImage?: string;
  /**
   * Requires `containerImage`. When replacing the container, omitted values
   * are not inherited from the template.
   */
  readonly command?: CommandInput;
  /**
   * A non-empty map becomes the replacement environment. Omitted or empty
   * produces an empty replacement environment when `containerImage` is set.
   * Empty `{}` without `containerImage` means inherit.
   */
  readonly environmentVariables?: EnvironmentVariables;
  /**
   * Requires `containerImage`. When replacing the container, supplying this
   * replaces spec volumes and the replacement container's mounts. Omitting it
   * keeps template volumes and drops mounts on the new container. Inherited
   * registered volumes that lose their mounts are rejected by Gateway;
   * inherited scratch volumes can remain unmounted.
   */
  readonly fileSystemSnapshot?: FileSystemSnapshotOptions;
  /**
   * Requires `containerImage`. When replacing the container, supplying this
   * replaces spec volumes and the replacement container's mounts. Omitting it
   * keeps template volumes and drops mounts on the new container. Inherited
   * registered volumes that lose their mounts are rejected by Gateway;
   * inherited scratch volumes can remain unmounted. `volumes: []` is rejected.
   */
  readonly volumes?: readonly ScratchVolumeOptions[];
  /**
   * Non-zero replaces the template scalar. `0` means inherit, not clear.
   */
  readonly maxLifetimeSeconds?: Seconds;
  /**
   * Requires `containerImage`. When replacing the container, omitted values
   * are not inherited from the template.
   */
  readonly mountedFiles?: MountedFiles;
  /**
   * Any defined `network`, including `{}`, replaces the complete template
   * network. Omitted members are not inherited.
   */
  readonly network?: NetworkOptions;
  /**
   * Requires `containerImage`. When replacing the container, omitted values
   * are not inherited from the template. CPU and memory only; GPU is not
   * supported on `ResourceOptions`.
   */
  readonly resources?: ResourceOptions;
  /**
   * Non-empty input replaces the complete list. Empty `[]` means inherit,
   * not clear. Co-emits CKS mode on the wire. There is no `placementMode`
   * option; CKS placement is only via non-empty `runnerIds`.
   */
  readonly runnerIds?: readonly string[];
  /**
   * Non-empty input replaces the complete list. Empty `[]` means inherit,
   * not clear.
   */
  readonly services?: readonly Service[];
  /**
   * Requires `containerImage`. When replacing the container, omitted values
   * are not inherited from the template. `secrets: []` still requires
   * `containerImage`.
   */
  readonly secrets?: Secrets;
  /**
   * Non-empty input replaces the complete list. Empty `[]` means inherit,
   * not clear.
   */
  readonly tags?: readonly SandboxTag[];
  /**
   * Wait for the sandbox to reach `running` before resolving creation helpers.
   *
   * Defaults to `true`. Set to `false` only when you need a handle as soon as
   * the backend accepts the start request.
   */
  readonly waitUntilRunning?: boolean;
}
/**
 * Options for `runFromFile`. Volumes, published services, secrets, mounted
 * files, and container/image overlays are not fields here; those callers use
 * `create` / `run`.
 */
interface SandboxRunFromFileOptions extends RequestOptions, DataPlaneOptions {
  /**
   * Compose service that is the sandbox primary. Required. Must name a
   * service in `contents`.
   */
  readonly primaryService: string;
  /** Document type. Defaults to `"compose"`. */
  readonly fileType?: SandboxFileType;
  /**
   * Per-service pullable image refs. Keys must be services in `contents`.
   * Use this when a service would otherwise need a build.
   */
  readonly imageOverrides?: Readonly<Record<string, string>>;
  /**
   * CPU and memory copied onto each service that omitted deploy resources.
   * Per container, not a project budget. GPU is not supported.
   */
  readonly defaultResources?: ResourceOptions;
  readonly annotations?: SandboxAnnotations;
  readonly maxLifetimeSeconds?: Seconds;
  readonly network?: NetworkOptions;
  readonly objectStorageAccess?: SandboxObjectStorageAccess;
  /**
   * Non-empty input pins CKS runners. There is no `placementMode` option;
   * CKS placement is only via non-empty `runnerIds`.
   */
  readonly runnerIds?: readonly string[];
  readonly tags?: readonly SandboxTag[];
  /**
   * Wait for the sandbox to reach `running` before resolving creation helpers.
   *
   * Defaults to `true`. Set to `false` only when you need a handle as soon as
   * the backend accepts the start request.
   */
  readonly waitUntilRunning?: boolean;
}
interface StopOptions extends RequestOptions {
  /**
   * Seconds to wait for a graceful shutdown. Defaults to 10. Pass `0` to kill
   * immediately. Standalone `delete()` does not use this default.
   */
  readonly gracefulShutdownSeconds?: Seconds;
  /**
   * When true, treat a missing sandbox (gRPC `NOT_FOUND` or trusted
   * `CWSANDBOX_SANDBOX_NOT_FOUND`) as success. Defaults to `false`.
   */
  readonly missingOk?: boolean;
}
interface DeleteOptions extends RequestOptions {
  /**
   * When true, treat a missing sandbox (gRPC `NOT_FOUND` or trusted
   * `CWSANDBOX_SANDBOX_NOT_FOUND`) as success. Defaults to `false`.
   */
  readonly missingOk?: boolean;
}
interface ListSandboxesOptions extends RequestOptions {
  readonly pageSize?: number;
  readonly pageToken?: string;
  readonly runnerIds?: readonly string[];
  /**
   * When true, include terminal sandboxes (completed, failed, terminated).
   * Listing defaults to active-only.
   */
  readonly showTerminated?: boolean;
  readonly status?: SandboxStatus;
  readonly tags?: readonly SandboxTag[];
}
/**
 * Options for `SandboxClient.listSandboxes()` and `SandboxClient.listAll()`.
 *
 * Omits `pageToken` because the helper owns pagination. `timeoutMs` is a
 * wall-clock budget across all pages (default 300s), not a per-page RPC timeout.
 */
type SandboxListOptions = Omit<ListSandboxesOptions, "pageToken"> & DataPlaneOptions;
interface SandboxExposedPort {
  readonly name?: string;
  readonly port: number;
  readonly protocol?: ServiceProtocol;
}
type SandboxResourceSpec = ResourceSpec;
interface SandboxMetadata {
  readonly dnsEgressNames?: readonly string[];
  readonly exitCode?: number;
  readonly exposedPorts?: readonly SandboxExposedPort[];
  readonly resourceLimits?: SandboxResourceSpec;
  readonly resourceRequests?: SandboxResourceSpec;
  readonly runnerGroupId?: string;
  readonly runnerId?: string;
  readonly sandboxId: SandboxId;
  readonly serviceAddresses?: readonly TlsPassthroughEndpointStatus[];
  readonly serviceEndpoints?: readonly HttpsEndpointStatus[];
  readonly serviceUrls?: readonly ServiceUrl[];
  readonly startedAt?: Date;
  readonly status?: SandboxStatus;
  readonly statusReason?: string;
}
interface SandboxInfo extends SandboxMetadata {
  readonly status: SandboxStatus;
}
interface ListSandboxesResult {
  readonly nextPageToken?: string;
  readonly sandboxes: readonly SandboxInfo[];
}
interface StartSandboxResult extends SandboxMetadata {
  /**
   * Create-only share token for `auth: "share_token"` HTTPS URLs. Get, list,
   * and `fromId` omit it. A live handle keeps a create-time value across
   * `wait` / `inspect`.
   */
  readonly endpointShareToken?: string;
}
interface GetSandboxResult extends SandboxMetadata {
  readonly status: SandboxStatus;
}
/** Public instance interface returned by client factories. */
interface Sandbox {
  readonly commands: SandboxCommands;
  readonly files: SandboxFiles;
  readonly logs: SandboxLogs;
  readonly sandboxId: SandboxId;
  readonly dnsEgressNames: readonly string[] | undefined;
  readonly endpointShareToken?: string | undefined;
  readonly exitCode: number | undefined;
  readonly exposedPorts: readonly SandboxExposedPort[] | undefined;
  readonly resourceLimits: SandboxResourceSpec | undefined;
  readonly resourceRequests: SandboxResourceSpec | undefined;
  readonly runnerGroupId: string | undefined;
  readonly runnerId: string | undefined;
  readonly serviceAddresses: readonly TlsPassthroughEndpointStatus[] | undefined;
  readonly serviceEndpoints: readonly HttpsEndpointStatus[] | undefined;
  readonly serviceUrls: readonly ServiceUrl[] | undefined;
  readonly startedAt: Date | undefined;
  readonly status: SandboxStatus | undefined;
  readonly statusReason: string | undefined;
  exec(command: CommandInput, options?: ExecOptions): Promise<ProcessResult>;
  inspect(options?: RequestOptions): Promise<GetSandboxResult>;
  getStatus(options?: RequestOptions): Promise<SandboxStatus>;
  shell(options?: ShellOptions): Promise<TerminalSession>;
  wait(options?: WaitOptions): Promise<Sandbox>;
  /**
   * Snapshot the sandbox's scratch volume and wait until READY or FAILED.
   *
   * Returns the READY Get record (not only the ID). Default `timeoutMs` is 600s
   * (plus 5s internal observation slack). Snapshots outlive sandbox stop/delete;
   * call `client.deleteSnapshot` to remove them. Inspect without waiting with
   * `client.getSnapshot` / `client.listSnapshots`.
   *
   * One inherited scratch (for example after `runFromTemplate` with no volume
   * overlay) can infer the volume. Multiple inherited scratches are a backend
   * error.
   */
  snapshot(options?: RequestOptions): Promise<FileSystemSnapshotResult>;
  stop(options?: StopOptions): Promise<void>;
  delete(options?: DeleteOptions): Promise<void>;
  [Symbol.asyncDispose](): Promise<void>;
}
//#endregion
//#region src/runtime/sandbox-list.d.ts
type ListPage = (options: ListSandboxesOptions) => Promise<ListSandboxesResult>;
type ToSandbox = (info: SandboxInfo) => Sandbox;
/**
 * Lazy paginated listing of sandboxes.
 *
 * Default async iteration yields individual sandbox handles. Handles are built
 * from list metadata only — no extra RPCs until a method is called on them.
 */
declare class SandboxList implements AsyncIterable<Sandbox> {
  private readonly listPage;
  private readonly toSandbox;
  private readonly options;
  constructor(listPage: ListPage, toSandbox: ToSandbox, options?: SandboxListOptions);
  [Symbol.asyncIterator](): AsyncGenerator<Sandbox, void, undefined>;
  /** Iterate list pages as they arrive (same timeout / abort / loop guards). */
  byPage(): AsyncIterable<readonly Sandbox[]>;
  /** Collect every matching sandbox across pages into one array. */
  collect(): Promise<readonly Sandbox[]>;
}
//#endregion
//#region src/public/client.d.ts
type WithSandboxCallback<TResult> = (sandbox: Sandbox) => Promise<TResult> | TResult;
/** Public interface returned by all CWSandbox client factories. */
interface SandboxClient {
  create(options?: SandboxRunOptions): Promise<Sandbox>;
  run(command: CommandInput, options?: SandboxRunOptions): Promise<Sandbox>;
  get(sandboxId: SandboxId, options?: RequestOptions): Promise<GetSandboxResult>;
  fromId(sandboxId: SandboxId, options?: FromIdOptions): Promise<Sandbox>;
  list(options?: ListSandboxesOptions): Promise<ListSandboxesResult>;
  listSandboxes(options?: SandboxListOptions): SandboxList;
  listAll(options?: SandboxListOptions): Promise<readonly Sandbox[]>;
  delete(sandboxId: SandboxId, options?: DeleteOptions): Promise<void>;
  getSnapshot(snapshotId: string, options?: RequestOptions): Promise<FileSystemSnapshotResult>;
  listSnapshots(options?: ListSnapshotsOptions): Promise<readonly FileSystemSnapshotResult[]>;
  deleteSnapshot(snapshotId: string, options?: DeleteSnapshotOptions): Promise<void>;
  withSandbox<TResult>(callback: WithSandboxCallback<TResult>, options?: SandboxRunOptions): Promise<TResult>;
  withSandbox<TResult>(command: CommandInput, callback: WithSandboxCallback<TResult>, options?: SandboxRunOptions): Promise<TResult>;
  /**
   * Starts from an organization template. Omitted options preserve template
   * values unless `containerImage` is supplied.
   *
   * Non-empty top-level collections replace template values. Empty top-level
   * collections/maps (`tags: []`, `services: []`, `annotations: {}`,
   * `runnerIds: []`) mean "no override," not "clear." `maxLifetimeSeconds: 0`
   * similarly preserves the template. There is no general clear-to-empty
   * operation on this surface.
   *
   * Once `containerImage` is supplied, the entire container list is replaced
   * with one `main` container. Omitted or empty container fields result in
   * empty/default values rather than inheritance.
   *
   * If creation returns an accepted sandbox but the readiness wait rejects, the
   * SDK best-effort stops it and rethrows the original readiness error.
   * `waitUntilRunning: false` returns immediately after accept with no
   * automatic cleanup.
   *
   * @param templateId Non-empty organization-scoped UUID. Format validation is
   *   performed by the backend.
   */
  runFromTemplate(templateId: string, options?: SandboxRunFromTemplateOptions): Promise<Sandbox>;
  /**
   * Starts from an organization template and always stops the sandbox after the
   * callback returns or throws. A callback error is rethrown; a cleanup failure
   * after a successful callback is thrown; a cleanup failure after a callback
   * or readiness error does not replace that error.
   *
   * Overlay semantics match `runFromTemplate`. The helper accepts the sandbox
   * first, then waits (unless `waitUntilRunning: false`) before the callback so
   * a readiness failure still `stop`s and the callback is not run.
   *
   * @param templateId Non-empty organization-scoped UUID. Format validation is
   *   performed by the backend.
   */
  withSandboxFromTemplate<TResult>(templateId: string, callback: WithSandboxCallback<TResult>, options?: SandboxRunFromTemplateOptions): Promise<TResult>;
  /**
   * Starts from a Compose file. `contents` is a filesystem path (`string`) or
   * raw file bytes (`Uint8Array`). A string is always opened as a path;
   * encode Compose text with `new TextEncoder().encode(...)`. Bytes are sent
   * as-is, so whitespace is part of the request. The file is capped at 256 KiB.
   *
   * Compose is pull-only. Images must already be pullable or supplied in
   * `imageOverrides`. Leftover `build:` is not implemented.
   * `primaryService` is required and must name a service in the file.
   *
   * This surface does not accept volumes, published services, secrets,
   * mounted files, or container/image overlays. Use `create` / `run` for
   * those. CPU and memory may be set with `defaultResources` (no GPU).
   *
   * If creation returns an accepted sandbox but the readiness wait rejects, the
   * SDK best-effort stops it and rethrows the original readiness error.
   * `waitUntilRunning: false` returns immediately after accept with no
   * automatic cleanup.
   */
  runFromFile(contents: SandboxFileContents, options: SandboxRunFromFileOptions): Promise<Sandbox>;
  /**
   * Starts from a Compose file and always stops the sandbox after the callback
   * returns or throws. A callback error is rethrown; a cleanup failure after a
   * successful callback is thrown; a cleanup failure after a callback or
   * readiness error does not replace that error.
   *
   * Overlay semantics match `runFromFile`. The helper accepts the sandbox
   * first, then waits (unless `waitUntilRunning: false`) before the callback so
   * a readiness failure still `stop`s and the callback is not run.
   */
  withSandboxFromFile<TResult>(contents: SandboxFileContents, callback: WithSandboxCallback<TResult>, options: SandboxRunFromFileOptions): Promise<TResult>;
}
//#endregion
export { ServiceVisibility as $, SandboxRunOptions as A, CommandProcessStatus as At, ResourceOptions as B, Milliseconds as Bt, SandboxInfo as C, DataPlaneOptions as Ct, SandboxResourceSpec as D, CommandInputWriter as Dt, SandboxObjectStorageAccess as E, CommandInputData as Et, StopOptions as F, ShellOptions as Ft, EndpointAuth as G, ResourceSpec as H, Seconds as Ht, WaitOptions as I, StartCommandOptions as It, HttpsEndpointStatus as J, EndpointKind as K, WaitTargetStatus as L, StartCommandOptionsWithStdin as Lt, SandboxTag as M, ExecOptions as Mt, ScratchVolumeOptions as N, ProcessResult as Nt, SandboxRunFromFileOptions as O, CommandOutputStream as Ot, StartSandboxResult as P, SandboxCommands as Pt, ServiceUrl as Q, SecretInput as R, TerminalResult as Rt, SandboxId as S, DataPlaneMode as St, SandboxMetadata as T, CommandInput as Tt, EgressRule as U, ResourceRequestsAndLimits as V, RequestOptions as Vt, Endpoint as W, Service as X, NetworkOptions as Y, ServiceProtocol as Z, Sandbox as _, FileWrites as _t, DeleteSnapshotOptions as a, LogRawStream as at, SandboxFileContents as b, MountedFiles as bt, FileSystemSnapshotResult as c, LogStream as ct, FromIdOptions as d, SandboxLogs as dt, TlsPassthroughEndpoint as et, GetSandboxResult as f, FileChunkSource as ft, ObjectStoragePermission as g, FileWrite as gt, ListSnapshotsOptions as h, FileTextReadResult as ht, DeleteOptions as i, LogRawChunk as it, SandboxStatus as j, CommandProcessWithStdin as jt, SandboxRunFromTemplateOptions as k, CommandProcess as kt, FileSystemSnapshotState as l, LogStreamMode as lt, ListSandboxesResult as m, FileReadResult as mt, WithSandboxCallback as n, LogEntry as nt, EnvironmentVariables as o, LogReadOptions as ot, ListSandboxesOptions as p, FileContent as pt, HttpsEndpoint as q, SandboxList as r, LogEntryStream as rt, FileSystemSnapshotOptions as s, LogResumeCursor as st, SandboxClient as t, TlsPassthroughEndpointStatus as tt, FileSystemSnapshotTrigger as u, LogStreamOptions as ut, SandboxAnnotations as v, MountedFile as vt, SandboxListOptions as w, Command as wt, SandboxFileType as x, SandboxFiles as xt, SandboxExposedPort as y, MountedFileContent as yt, Secrets as z, TerminalSession as zt };
//# sourceMappingURL=client-DpqdEOsC.d.ts.map