/** * Parse docker compose stderr for host-port bind failures and turn them into * an actionable hint that names the conflicting port and the env var to * override. * * Docker wraps the same failure differently across versions and platforms — * Docker 29 on macOS nests it three deep: * * Error response from daemon: failed to set up container networking: driver * failed programming external connectivity on endpoint out-api-1 (a1b2…): * Bind for 0.0.0.0:3001 failed: port is already allocated * * Matching whole message shapes means a new wrapper silently drops the hint, so * we anchor on the terminal phrase instead and take the host port nearest to it. * That survives wrappers we haven't seen. * * The port is then mapped back to the env var that sets it. The map prefers a * runtime lookup of resolved ports (so a user who already set * OUTPUT_API_HOST_PORT=3050 sees that var named when 3050 collides) and falls * back to a default-port table for the unresolved case. */ /** * Find the first host port mentioned in a docker compose bind failure. * Returns null when no recognized pattern matches. */ export declare function extractCollidedPort(stderr: string): number | null; /** * Build an actionable, multi-line hint for the first port collision found in * stderr. Returns null when no collision is detected. When the colliding port * is one we own (api / temporalUi / temporal), the hint names the env var * that overrides it; otherwise it suggests freeing the port. */ export declare function formatPortCollisionHint(stderr: string, resolvedPorts: Record): string | null; /** * Compose a docker-failure message from a caller-supplied core sentence and the * process's recent output: an actionable port-collision hint (when one is * detected) is prepended, and the raw recent output is appended. Shared by the * foreground exit handler and the detached/reconcile path so both surface the * same failure shape. */ export declare function formatComposeFailure(reason: string, output: string, resolvedPorts: Record): string; /** * Build a hint from a known list of colliding ports. For a single collision * the output matches `formatPortCollisionHint` exactly so callers stay * symmetric. For multiple collisions a bulleted list is rendered, each line * naming the env var that overrides that specific port (or a generic * suggestion when the port isn't one we own). */ export declare function formatPortCollisionsHint(ports: number[], resolvedPorts: Record): string;