declare const DEFAULT_RAILWAY_GRAPHQL_ENDPOINT = "https://backboard.railway.com/graphql/v2"; interface RailwayClientConfig { token?: string; endpoint?: string; fetch?: typeof fetch; } interface RailwayGraphQLErrorItem { message: string; path?: readonly (string | number)[]; extensions?: Record; [key: string]: unknown; } declare class RailwayError extends Error { constructor(message: string, options?: ErrorOptions); } declare class RailwayAuthError extends RailwayError { readonly variable: string; constructor(variable: string); } declare class RailwayGraphQLError extends RailwayError { readonly status: number; readonly errors: readonly RailwayGraphQLErrorItem[]; readonly responseBody: unknown; constructor(args: { message: string; status: number; errors?: readonly RailwayGraphQLErrorItem[]; responseBody?: unknown; }); } type SandboxStatus$1 = 'CREATING' | 'DESTROYED' | 'DESTROYING' | 'FAILED' | 'RUNNING'; type RailwaySandboxFieldsFragment = { __typename?: 'Sandbox'; id: string; status: SandboxStatus$1; environmentId: string; region: string; idleTimeoutMinutes?: number | null; createdAt: string; }; type RailwaySandboxExecMutation = { __typename?: 'Mutation'; sandboxExec: { __typename?: 'SandboxExecResult'; exitCode: number; stdout: string; stderr: string; truncated: boolean; timedOut: boolean; }; }; type SandboxStatus = RailwaySandboxFieldsFragment["status"]; type ExecResult = RailwaySandboxExecMutation["sandboxExec"]; type SandboxInfo = RailwaySandboxFieldsFragment; interface CreateOptions extends RailwayClientConfig { environmentId?: string; idleTimeoutMinutes?: number; } interface ConnectOptions extends RailwayClientConfig { environmentId?: string; } interface ListOptions extends RailwayClientConfig { environmentId?: string; first?: number; after?: string; } interface ExecOptions { timeoutSec?: number; } interface TemplateBuildOptions extends RailwayClientConfig { environmentId?: string; } /** Immutable sandbox base recipe returned by `Sandbox.template()`. */ interface SandboxTemplate { /** Add a shell command build step. */ run(command: string): SandboxTemplate; /** Install Debian packages with apt. */ withPackages(...packages: string[]): SandboxTemplate; /** Set environment variables for later build steps. */ withEnv(vars: Record): SandboxTemplate; /** Set the working directory for later build steps. */ workdir(dir: string): SandboxTemplate; /** Build the template before creating sandboxes from it. */ build(options?: TemplateBuildOptions): Promise; } /** * A live Railway sandbox. There is no separate client: a sandbox always comes * from somewhere — nothing (`Sandbox.create`), an id (`Sandbox.connect`), or a * reusable base (`Sandbox.template()`). The constructor is private; use the * static factories. */ declare class Sandbox implements AsyncDisposable { #private; private constructor(); get id(): string; get status(): SandboxStatus; get environmentId(): string; get region(): string; get idleTimeoutMinutes(): number | null; get createdAt(): string; /** Return a new immutable sandbox template. */ static template(): SandboxTemplate; static create(template: SandboxTemplate, options?: CreateOptions): Promise; static create(options?: CreateOptions): Promise; static connect(id: string, options?: ConnectOptions): Promise; static list(options?: ListOptions): Promise; exec(command: string, options?: ExecOptions): Promise; destroy(): Promise; /** Re-reads the sandbox to refresh `status` and other fields in place. */ refresh(): Promise; [Symbol.asyncDispose](): Promise; toJSON(): SandboxInfo; } declare class SandboxNotFoundError extends RailwayError { readonly id: string; readonly environmentId: string; constructor(args: { id: string; environmentId: string; }); } /** A sandbox reached FAILED/DESTROYING/DESTROYED before becoming RUNNING. */ declare class SandboxFailedError extends RailwayError { readonly id: string; readonly status: SandboxStatus; constructor(args: { id: string; status: SandboxStatus; }); } /** A server-side template build finished in the FAILED state. */ declare class SandboxTemplateBuildError extends RailwayError { readonly templateId: string; readonly environmentId: string; constructor(args: { templateId: string; environmentId: string; }); } /** A readiness wait timed out. */ declare class SandboxTimeoutError extends RailwayError { readonly resource: "sandbox" | "template"; readonly id: string; readonly lastStatus: string; readonly timeoutMs: number; constructor(args: { resource: "sandbox" | "template"; id: string; lastStatus: string; timeoutMs: number; }); } export { type ConnectOptions, type CreateOptions, DEFAULT_RAILWAY_GRAPHQL_ENDPOINT, type ExecOptions, type ExecResult, type ListOptions, RailwayAuthError, type RailwayClientConfig, RailwayError, RailwayGraphQLError, type RailwayGraphQLErrorItem, Sandbox, SandboxFailedError, type SandboxInfo, SandboxNotFoundError, type SandboxStatus, type SandboxTemplate, SandboxTemplateBuildError, SandboxTimeoutError, type TemplateBuildOptions };