/** * Whether a control-plane failure is eligible for the SSH/direct fallback. * * The control plane is tried first only while it is unavailable or not * deployed; authentication and validation decisions (401/403/409/422) and any * failure after a run was admitted are always surfaced instead. * * @param {unknown} error * @returns {boolean} */ export function isFallbackEligible(error: unknown): boolean; /** * @param {unknown} value * @returns {value is string} Whether the value is a full 40-character commit SHA. */ export function isFullCommitSha(value: unknown): value is string; /** * Resolves the immutable revision a control-plane deploy requires. A full * 40-character SHA is used as-is; otherwise the configured release branch is * resolved to its current tip with `git ls-remote`. * * @param {{repo?: string, revision?: string, branch?: string, execFileImpl?: typeof execFile}} args * @returns {Promise} Full commit SHA. */ export function resolveControlPlaneRevision({ repo, revision, branch, execFileImpl }: { repo?: string; revision?: string; branch?: string; execFileImpl?: typeof execFile; }): Promise; /** * Creates a deployment run on the control plane and classifies the outcome. * * @param {{endpoint: string, accessToken: string, project: string, stage: string, revision: string, expectedActiveRevision?: string, idempotencyKey: string, fetchImpl?: typeof fetch}} args * @returns {Promise<{run: DeploymentRun, replayed: boolean, coalesced: boolean}>} */ export function createDeploymentRun({ endpoint, accessToken, project, stage, revision, expectedActiveRevision, idempotencyKey, fetchImpl }: { endpoint: string; accessToken: string; project: string; stage: string; revision: string; expectedActiveRevision?: string; idempotencyKey: string; fetchImpl?: typeof fetch; }): Promise<{ run: DeploymentRun; replayed: boolean; coalesced: boolean; }>; /** * Polls a control-plane run until it reaches a terminal status. Any failure * after admission (including lost contact) is a hard error: the run exists on * the control plane, so there is nothing left to fall back to. * * @param {{endpoint: string, accessToken: string, runId: string, pollIntervalMs?: number, timeoutMs?: number, fetchImpl?: typeof fetch, now?: () => number, reporter?: Reporter}} args * @returns {Promise} */ export function pollDeploymentRun({ endpoint, accessToken, runId, pollIntervalMs, timeoutMs, fetchImpl, now, reporter }: { endpoint: string; accessToken: string; runId: string; pollIntervalMs?: number; timeoutMs?: number; fetchImpl?: typeof fetch; now?: () => number; reporter?: Reporter; }): Promise; /** * Deploys a stage through the mounted control plane: resolves the immutable * revision, creates an idempotent run, polls it to completion, and returns the * control-plane deploy report annotated with the run identifier. * * @param {{stage: import('#types').StageConfig, httpConfig: import('#types').HttpTransportConfig, revision?: string, expectedActiveRevision?: string, reporter?: Reporter, fetchImpl?: typeof fetch}} args * @returns {Promise} */ export function deployViaControlPlane({ stage, httpConfig, revision, expectedActiveRevision, reporter, fetchImpl }: { stage: import("#types").StageConfig; httpConfig: import("#types").HttpTransportConfig; revision?: string; expectedActiveRevision?: string; reporter?: Reporter; fetchImpl?: typeof fetch; }): Promise; /** * Builds a client-generated idempotency key that is stable per invocation, so * retrying the same command replays an existing admitted run instead of * creating a duplicate. * * @param {string} project * @param {string} stage * @param {string} revision * @returns {string} */ export function controlPlaneIdempotencyKey(project: string, stage: string, revision: string): string; /** * @name DeploymentRun * @description Public representation of a control-plane deployment run. * @typedef {object} DeploymentRun * @property {string} id * @property {string} status * @property {Record} [result] * @property {{message?: string, recovery?: any, exitCode?: number, signal?: string, step?: string}} [error] */ /** * Control-plane failure that must not trigger a transport fallback: an * authenticated admission decision (401/403/409/422), a 5xx that already * admitted a run, or an interruption after a run was admitted. */ export class ControlPlaneError extends Error { /** * @param {string} message * @param {{status?: number, cause?: unknown, runId?: string|null}} [opts] */ constructor(message: string, { status, cause, runId }?: { status?: number; cause?: unknown; runId?: string | null; }); /** @type {number|null} */ status: number | null; /** @type {string|null} */ runId: string | null; } /** * Control-plane unavailability that may fall back to the direct transport: * network-level failure, a not-deployed endpoint/target (404), or a 5xx * without any admitted run. */ export class ControlPlaneUnavailableError extends ControlPlaneError { /** * @param {string} message * @param {{status?: number, cause?: unknown}} [opts] */ constructor(message: string, { status, cause }?: { status?: number; cause?: unknown; }); } export type DeploymentRun = { id: string; status: string; result?: Record | undefined; error?: { message?: string; recovery?: any; exitCode?: number; signal?: string; step?: string; } | undefined; }; import { execFile } from "node:child_process"; import { Reporter } from "../core/reporter.js"; //# sourceMappingURL=client.d.ts.map