import { t as WorkspaceEgressPolicy } from "../../shared-3MpgXJDw.js"; import { n as WorkspaceBackend, t as BackendHandle } from "../../shared-C-sNJ-xg.js"; import { RpcTarget } from "cloudflare:workers"; //#region src/backends/container/container-launch-record.d.ts /** Instance size accepted by `start()`, as the platform declares it. */ type ContainerInstanceSize = NonNullable; interface ContainerLaunchSpec extends Omit { env: Record; enableInternet: boolean; /** Key into `ctx.container.images`, resolved by the container host. */ name?: string; } //#endregion //#region src/backends/container/container-lifecycle.d.ts interface ContainerExitInfo { exitedAt: number; reason: string; } //#endregion //#region src/backends/container/container-host.d.ts interface WorkspaceRef { binding: string; id: string; name?: string; } interface ContainerRuntimeInfo { runtimeId: string; clientSecret: string; outcome: "launched" | "adopted" | "relaunched"; } interface IWorkspaceContainerAPI { start(spec: ContainerLaunchSpec): Promise; interceptOutboundHttp(host: string, workspace: WorkspaceRef): Promise; interceptAllOutboundHttp(workspace: WorkspaceRef, token: string): Promise; fetchPort(port: number, input: RequestInfo | URL, init?: RequestInit): Promise; port(port: number): Fetcher; restart(spec: ContainerLaunchSpec): Promise; setInactivityTimeout(durationMs: number): Promise; status(): Promise<{ running: boolean; exit: ContainerExitInfo | null; }>; exitInfo(): Promise; } declare class WorkspaceContainerAPI extends RpcTarget implements IWorkspaceContainerAPI { #private; constructor(ctx: DurableObjectState); start(spec: ContainerLaunchSpec): Promise; restart(spec: ContainerLaunchSpec): Promise; setInactivityTimeout(durationMs: number): Promise; status(): Promise<{ running: boolean; exit: ContainerExitInfo | null; }>; exitInfo(): Promise; interceptAllOutboundHttp(ref: WorkspaceRef, token: string): Promise; interceptOutboundHttp(host: string, ref: WorkspaceRef): Promise; fetchPort(port: number, input: RequestInfo | URL, init?: RequestInit): Promise; port(port: number): { fetch(input: RequestInfo | URL, init?: RequestInit): Promise; connect(address: SocketAddress | string, options?: SocketOptions): Socket; }; } type DOCtor = new (...args: any[]) => object; type WithWorkspaceContainerCtor = TBase & (new (...args: any[]) => InstanceType & { getWorkspaceContainer(): WorkspaceContainerAPI; }); /** * Adds the container host surface that `ContainerBackend` dials to a durable object class. * * Experimental: this API may change in any release and is not yet * suitable for production use. */ declare function withWorkspaceContainer(Base: TBase): WithWorkspaceContainerCtor; //#endregion //#region src/backends/container/container-backend.d.ts interface ContainerHostHolder { getWorkspaceContainer(): IWorkspaceContainerAPI | Promise; } interface ContainerBackendOptions { container: () => ContainerHostHolder | Promise; workspace: WorkspaceRef; egressHost?: string; egress?: WorkspaceEgressPolicy; containerPort?: number; containerEnv?: Record; connectTimeoutMs?: number; heartbeatIntervalMs?: number; ignore?: readonly string[]; restartAttempts?: number; healthProbeTimeoutMs?: number; healthRetryInitialDelayMs?: number; healthRetryMaxDelayMs?: number; id?: string; name?: string; instance?: ContainerInstanceSize; launch?: Omit; } /** * Runs shell commands in a Cloudflare Container through `computerd`. * * Experimental: this API may change in any release and is not yet * suitable for production use. */ declare class ContainerBackend implements WorkspaceBackend { #private; readonly type = "cloudflare-container"; /** What this backend tells a model: a full Linux shell, its network access, and its slow start. */ readonly description: string; readonly id: string; constructor(options: ContainerBackendOptions); connect(): Promise; handleFetch(req: Request): Promise; } //#endregion export { ContainerBackend, type ContainerBackendOptions, type ContainerHostHolder, type ContainerInstanceSize, type ContainerLaunchSpec, type ContainerRuntimeInfo, type IWorkspaceContainerAPI, WorkspaceContainerAPI, type WorkspaceEgressPolicy, type WorkspaceRef, withWorkspaceContainer }; //# sourceMappingURL=index.d.ts.map