import { R as RailwayClientConfig } from './index-ErNNPAek.js'; export { B as BucketConfig, a as BucketNode, b as BucketRegion, C as ChangeDeployEffect, c as ChangeDiagnostic, d as ChangeSeverity, e as CompileResult, D as DEFAULT_RAILWAY_GRAPHQL_ENDPOINT, f as DatabaseConfig, g as DatabaseNode, E as EnvironmentConfig, h as EvaluatedRailwayProject, G as GraphCompileOptions, i as GraphIndex, I as IacClient, P as ProjectDefinition, j as ProjectNode, k as RAILWAY_GRAPH_VERSION, l as RailwayChange, m as RailwayChangeSet, n as RailwayGraph, o as RailwayProgram, p as RailwayResourceName, q as RailwayServiceName, r as ResourceAddress, s as ResourceNode, S as ServiceConfigInput, t as ServiceNode, V as VariableValue, u as bucket, v as changeSetToEnvironmentPatch, w as changeSetToGraph, x as createRailwayContext, y as database, z as define, A as defineRailway, F as diffGraphs, H as empty, J as environmentConfigToGraph, K as evaluateRailwayFile, L as evaluateRailwayProject, M as findRailwayFile, N as fn, O as github, Q as graphToEnvironmentConfig, T as group, U as iac, W as image, X as indexGraph, Y as mongo, Z as mysql, _ as postgres, $ as project, a0 as redis, a1 as ref, a2 as renderChangeSet, a3 as renderPatchDiff, a4 as renderRailwayGraphTypes, a5 as resourceAddress, a6 as service, a7 as template, a8 as validateChangeSet, a9 as validateGraph, aa as volume } from './index-ErNNPAek.js'; 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); } /** A WebSocket or network transport failure. */ declare class RailwayConnectionError extends RailwayError { readonly closeCode: number | undefined; constructor(args: { message: string; closeCode?: number; cause?: unknown; }); } 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; }); } /** Controls a sandbox's access to the environment's private network. */ type SandboxNetworkIsolation$1 = /** Peer-isolated with public NAT egress only; no access to the environment's private network. Default. */ 'ISOLATED' /** Joins the environment's private network. */ | 'PRIVATE'; type SandboxStatus$1 = 'CREATING' | 'DESTROYED' | 'DESTROYING' | 'FAILED' | 'RUNNING'; type RailwaySandboxFieldsFragment = { __typename?: 'Sandbox'; id: string; status: SandboxStatus$1; networkIsolation: SandboxNetworkIsolation$1; environmentId: string; region: string; idleTimeoutMinutes?: number | null; createdAt: string; }; type RailwaySandboxCheckpointFieldsFragment = { __typename?: 'SandboxCheckpoint'; id: string; key: string; environmentId: string; createdAt: string; }; type SandboxStatus = RailwaySandboxFieldsFragment["status"]; type SandboxNetworkIsolation = RailwaySandboxFieldsFragment["networkIsolation"]; type SandboxInfo = RailwaySandboxFieldsFragment; /** Final outcome of an exec; identical shape for short and long-running commands. */ interface ExecResult { /** Process exit code; -1 means terminated by a signal (e.g. after `kill()`). */ exitCode: number | null; stdout: string; stderr: string; /** True when the server cut the output; the streams may be incomplete. */ truncated: boolean; /** True when the client-side `timeoutSec` deadline killed the command. */ timedOut: boolean; } /** * A bootable snapshot of a sandbox's disk. `key` is the user-given name for * checkpoints captured with `checkpoint`, or the recipe hash for built ones. */ type SandboxCheckpointInfo = RailwaySandboxCheckpointFieldsFragment; /** Knobs shared by every sandbox-creating call: `create`, `create(template)`, and `fork`. */ interface SandboxCreationOptions { idleTimeoutMinutes?: number; networkIsolation?: SandboxNetworkIsolation; /** Runtime env baked into the sandbox, available to every command. Values may use Railway references (e.g. `${{shared.FOO}}`). */ env?: Record; } interface CreateOptions extends RailwayClientConfig, SandboxCreationOptions { environmentId?: string; } type ForkOptions = SandboxCreationOptions; interface ConnectOptions extends RailwayClientConfig { environmentId?: string; } interface ListOptions extends RailwayClientConfig { environmentId?: string; first?: number; after?: string; } /** Reattach to an exec started earlier (its name comes from `ExecHandle.sessionName`). */ interface ExecReattachTarget { sessionName: string; } type ExecTarget = string | ExecReattachTarget; /** Signal names accepted by `ExecHandle.kill()` (sent to the process group). */ type ExecSignal = "HUP" | "INT" | "QUIT" | "KILL" | "TERM"; interface ExecOptions { /** * Kill the command after this many seconds and resolve with * `timedOut: true`. Enforced client-side by closing the exec session. */ timeoutSec?: number; /** Receives each stdout chunk as it arrives. A throw rejects the exec. */ onStdout?: (chunk: string) => void; /** Receives each stderr chunk as it arrives. A throw rejects the exec. */ onStderr?: (chunk: string) => void; /** * On reattach (`exec({ sessionName })`), set `true` to resume from the * server's last-read cursor — exact, but lossy if a previous reading client * didn't keep up before detaching. Defaults to `false`: replay all retained * logs for the session (lossless, may repeat output an earlier reader saw). * Ignored on a fresh exec. */ resumeFromLastRead?: boolean; } interface TemplateBuildOptions extends RailwayClientConfig { environmentId?: string; } /** Connection/environment options for the checkpoint statics (`Sandbox.checkpoints` etc.). */ interface CheckpointOptions 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 build-time environment variables available to the build instructions. * Values may use Railway references (e.g. `${{shared.FOO}}`), resolved at * build time. Build-time only — runtime env comes from `create({ env })`. */ 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; } /** * An in-flight exec. Awaiting it (or any Promise method) yields the final * `ExecResult`; `sessionName` and `kill()` manage the command while it runs. */ declare class ExecHandle implements Promise { #private; /** Durable session name for this exec; reattach via `exec({ sessionName })`. */ readonly sessionName: Promise; readonly [Symbol.toStringTag] = "ExecHandle"; /** Constructed by `Sandbox.exec`; not constructible from outside the SDK. */ private constructor(); then(onfulfilled?: ((value: ExecResult) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null): Promise; catch(onrejected?: ((reason: unknown) => TResult | PromiseLike) | null): Promise; finally(onfinally?: (() => void) | null): Promise; /** The final result as a plain promise; identical to awaiting the handle. */ result(): Promise; /** * Terminate the running command with a signal (default `TERM`) delivered to * its process group — a real kill, regardless of durable sessions. The handle * then settles with the command's exit (a signalled process reports exit code * `-1`). To stop streaming WITHOUT ending the command, use `detach()`. */ kill(signal?: ExecSignal): Promise; /** * Stop streaming and close the WebSocket without ending the command — the * durable session keeps running server-side. Resolves with its `sessionName` * so you can reattach later via `exec({ sessionName })`; rejects if the server * assigned no durable session (reattach is impossible). The handle itself * settles with the output captured up to the detach. */ detach(): Promise; } /** * A live Railway sandbox. There is no separate client: a sandbox always comes * from somewhere — nothing (`Sandbox.create`), an id (`Sandbox.connect`), a * reusable base (`Sandbox.template()`), or a saved checkpoint * (`Sandbox.create(name)`). The constructor is private; use the * static factories. */ declare class Sandbox implements AsyncDisposable { #private; private constructor(); get id(): string; get status(): SandboxStatus; /** Network access mode: `ISOLATED` (NAT egress only) or `PRIVATE` (joins the environment private network). */ get networkIsolation(): SandboxNetworkIsolation; get environmentId(): string; get region(): string; get idleTimeoutMinutes(): number | null; get createdAt(): string; /** Return a new immutable sandbox template. */ static template(): SandboxTemplate; /** Boot from a saved checkpoint (one captured with `checkpoint`). */ static create(checkpointName: string, options?: CreateOptions): Promise; static create(template: SandboxTemplate, options?: CreateOptions): Promise; static create(source: Sandbox, options?: ForkOptions): Promise; static create(options?: CreateOptions): Promise; static connect(id: string, options?: ConnectOptions): Promise; static list(options?: ListOptions): Promise; /** List the environment's named checkpoints (newest first). */ static checkpoints(options?: CheckpointOptions): Promise; /** Rename a checkpoint by id; new sandboxes boot from it via the new name. */ static renameCheckpoint(id: string, name: string, options?: CheckpointOptions): Promise; /** Delete a checkpoint by id (find it by `key` via `Sandbox.checkpoints`). */ static deleteCheckpoint(id: string, options?: CheckpointOptions): Promise; /** * Run a command. Awaiting the handle resolves the final `ExecResult` — * short commands return directly, long-running ones transparently stream * output (see `ExecOptions.onStdout`/`onStderr`) until the command exits. * The handle also exposes `sessionName` and `kill()`. A `timeoutSec` deadline * kills the command and resolves with `timedOut: true` rather than * rejecting. */ exec(command: string, options?: ExecOptions): ExecHandle; /** Reattach to a running exec by session name; resumes the retained output. */ exec(target: ExecReattachTarget, options?: ExecOptions): ExecHandle; /** * Fork this running sandbox into a new, independent one. Clones the * filesystem (a fresh boot, not live processes) into the same environment. */ fork(options?: ForkOptions): Promise; /** * Capture this sandbox's current disk into a reusable named checkpoint, * bootable as soon as this resolves. The sandbox must be running and the * name unused. Boot new sandboxes from it with `Sandbox.create(name)`. */ checkpoint(name: string): 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 CheckpointOptions, type ConnectOptions, type CreateOptions, ExecHandle, type ExecOptions, type ExecReattachTarget, type ExecResult, type ExecSignal, type ExecTarget, type ForkOptions, type ListOptions, RailwayAuthError, RailwayClientConfig, RailwayConnectionError, RailwayError, RailwayGraphQLError, type RailwayGraphQLErrorItem, Sandbox, type SandboxCheckpointInfo, SandboxFailedError, type SandboxInfo, type SandboxNetworkIsolation, SandboxNotFoundError, type SandboxStatus, type SandboxTemplate, SandboxTemplateBuildError, SandboxTimeoutError, type TemplateBuildOptions };