import type { WorkerConfig } from "./config"; /** * Pull the latest version of a Docker image. * For remote registries this fetches new layers; for local-only images * (no registry prefix) the pull is skipped gracefully. * * @param force Skip local-image detection and always attempt a pull. */ export declare function pullImageIfNewer(image: string, force?: boolean): Promise; interface ActorConfigEnvelope { jobId: string; runId: string; actorInstanceId: string; userInput: Record; } /** Extra env vars injected when running in distributed (multi-container) mode. */ interface DistributedOpts { /** Full Redis URL for the per-run crawler queue, e.g. redis://host:6379 */ crawlerRedisUrl: string; /** Redis key namespace — typically the runId */ queueName: string; /** Human-readable container label, e.g. "worker-1" */ workerId: string; /** Seconds to wait with an empty queue before the container shuts down */ idleTimeoutSecs: number; } /** * Start the dory-core scraping container in detached mode. * Returns the container ID. * * @param dockerImage Image to run — sourced from GET /api/runs/:id/config * so the API controls what version runs everywhere. */ export declare function startContainer(config: WorkerConfig, actorConfig: ActorConfigEnvelope, memoryLimit: number, dockerImage: string, distributed?: DistributedOpts): Promise; /** * Spawn `count` containers for a distributed run. * All containers share the same Redis queue (`queueName`) so they * collaborate on the same crawl without duplicating work. * * Returns the list of container IDs in order (worker-1 … worker-N). */ export declare function startContainersForRun(config: WorkerConfig, actorConfig: ActorConfigEnvelope, memoryLimit: number, dockerImage: string, crawlerRedisUrl: string, queueName: string, count: number, idleTimeoutSecs: number): Promise; /** * Block until the container exits and return its exit code. * If the container exceeds `timeoutSecs`, it is force-killed. */ export declare function waitForContainer(containerId: string, timeoutSecs: number): Promise; /** Force-stop a container. Best-effort: a already-exited/removed container is * not an error. */ export declare function killContainer(containerId: string): Promise; /** * Like waitForContainer, but also aborts when `shouldCancel()` reports the run * was cancelled — `docker kill`s the container and returns the SIGKILL code. * Polls the container's exit state (instead of a single blocking `docker wait`) * so cancellation is observed within ~`pollMs`. Returns the real exit code on * natural exit, or 137 if killed (cancel or timeout). */ export declare function waitForContainerOrCancel(containerId: string, timeoutSecs: number, shouldCancel: () => Promise, pollMs?: number): Promise<{ exitCode: number; cancelled: boolean; }>; export {}; //# sourceMappingURL=docker.d.ts.map