/** * Basic Docker utilities * * Availability checks, image operations, container naming. */ import { AGENT_VERSION } from '../constants'; export declare const IMAGE_NAME = "ai-support-agent"; export declare function getDockerPath(): string; /** Reset the cached docker path and DOCKER_HOST — for use in tests only. */ export declare function resetDockerPathCache(): void; export declare function checkDockerAvailable(): boolean; export declare function imageExists(version: string): boolean; export declare function buildImage(version: string, customDockerfile?: string): void; /** * Remove every locally cached `ai-support-agent` image tag other than * `currentVersion`. Each version bump builds a brand new multi-GB image * (Playwright/Ansible/AWS CLI etc. baked in) and nothing ever removed the * superseded tag, so repeated rebuilds across versions silently grew the * Docker Desktop disk without bound until it was exhausted mid-build (surfaced * as an unrelated-looking "not enough free space" apt-get failure). Scoped to * our own IMAGE_NAME only — never touches images/cache belonging to other * projects. Best-effort: a tag that fails to remove (e.g. still referenced by * a running container) is skipped rather than aborting the rest. */ /** Extract the most useful message from a failed execFileSync call: prefer captured stderr over the generic "Command failed: ..." message. */ export declare function execErrorMessage(err: unknown): string; export declare function pruneOldImages(currentVersion: string): void; /** * Build a deterministic container name for a project. * Format: ai-{tenantCode}-{projectCode}-{agentId} * All components are lowercased and non-alphanumeric chars (except hyphens) are replaced with hyphens. */ export declare function buildContainerName(tenantCode: string, projectCode: string, agentId?: string): string; /** * Remove a stale container with the given name if it exists. * This handles the case where a previous run crashed and left a container behind, * which would prevent `docker run --name` from succeeding. */ export declare function removeStaleContainer(containerName: string): void; export declare function dockerLogin(): void; /** Convert a path.relative() result to POSIX format for container use */ export declare function toPosixRelative(relativePath: string): string; /** * Returns true when running via ts-node (i.e. `npm run dev`). * In this case, local dist/ should be mounted into containers instead of * relying on the npm-installed package inside the image. */ export declare function isRunningViaTsNode(): boolean; /** * Returns extra volume mount args to overlay the local dist/ into the container * when running in dev mode (ts-node), so the container uses local source code. * Returns an empty array when not in dev mode. */ export declare function buildDevMounts(): string[]; /** * Generate a session ID from the current timestamp. * Format: YYYYMMDDHHmmss */ export declare function makeSessionId(): string; /** Check if a project-specific image tag exists; fall back to base image tag. */ export declare function resolveImageTag(projectTag: string, baseTag: string): string; export { AGENT_VERSION }; //# sourceMappingURL=docker-utils.d.ts.map