import type { Harness, Workspace, WorkspaceLaunch, WorkspaceRuntimeInfo, WorkspaceImage, WorkspacePhase, WorkspaceStatus } from "../types.js"; import type { SdkContext } from "./context.js"; export interface WorkspaceInit { readonly id: string; readonly name: string; readonly status: WorkspaceStatus; /** Present when the handle came from `create()` (needed by `harness.run()`). */ readonly harness?: Harness; /** * This handle created the workspace (`workspaces.create()`), so a readiness timeout on it is * an abandoned launch the SDK owns: `ready()` stops the workspace before it throws. */ readonly created?: boolean; /** What the create answered of the launch (run, executor when known, replayed). */ readonly launch?: WorkspaceLaunch; /** `ready()`'s bounds for this handle, from `create()` (see `WorkspaceReadyOptions`). */ readonly readyTimeoutMs?: number; readonly imageBuildTimeoutMs?: number; } /** The wire runtime as the SDK reports it. */ export declare const toRuntimeInfo: (runtime: { readonly adapter: "cloudflare" | "docker" | "k3s" | "k8s" | "microvm"; readonly resourceId: string; readonly reference: string; readonly status: "failed" | "pending" | "ready" | "retained" | "running" | "stopped"; readonly endpoint?: string | undefined; readonly deadline?: string | null | undefined; readonly runId?: string | undefined; readonly launchId?: string | undefined; }) => WorkspaceRuntimeInfo; /** `ready()`'s default readiness bound: the launch outside an image build (queued, booting). */ export declare const READY_TIMEOUT_MS: number; /** * `ready()` gives up on an image build that reported no new progress for this long, or for the * control plane's own stall bound plus `IMAGE_BUILD_STALL_GRACE_MS`, whichever is longer. The * control plane fails a stalled build itself; this covers a worker that died mid-build and was * never replaced. A build that never reported progress (a builder that reports none, a worker * that died before its first write) is given up on this long after it started, unless the caller * set `imageBuildTimeoutMs`. */ export declare const IMAGE_BUILD_STALL_GUARD_MS: number; /** * The `harness.run()`/`harness.start()` implementations are injected by the run-execution module to * avoid a static dependency cycle (workspace <-> run execution). Until they are registered, both * report that the feature is not wired in this build. */ export type RunHarnessFn = (ctx: SdkContext, init: WorkspaceInit, prompt: string, options?: import("../types.js").RunOptions) => Promise; export interface HarnessExecutors { /** BLOCKING `harness.run()`: resolves once the run is terminal. */ readonly run: RunHarnessFn; /** NON-BLOCKING `harness.start()`: returns the live handle immediately. */ readonly start: RunHarnessFn; } export declare const registerHarnessExecutors: (executors: HarnessExecutors) => void; /** Wire → public launch phase. */ export declare const toWorkspacePhase: (phase: { readonly name: "boot" | "image-build" | "queued"; readonly since?: string | undefined; readonly imageBuild?: { readonly step?: number | undefined; readonly steps?: number | undefined; readonly stepName?: string | undefined; readonly progressAt: string; readonly stallTimeoutMs?: number | undefined; } | undefined; }) => WorkspacePhase; /** `Building the workspace image (step 2/12: RUN apt-get …)`, `Booting the workspace`. */ export declare const describeWorkspacePhase: (phase: WorkspacePhase) => string; /** Wire → public published image. */ export declare const toWorkspaceImage: (image: { readonly reference: string; readonly digestReference: string; readonly digest: string; readonly personLayout?: { readonly status: "supported" | "unknown" | "unsupported"; readonly missing: readonly string[]; readonly unknown: readonly string[]; readonly runtime: string; readonly acl: "supported" | "unknown" | "unsupported"; } | undefined; }) => WorkspaceImage; export declare const makeWorkspace: (ctx: SdkContext, init: WorkspaceInit) => Workspace;