import { type ReadyReleaseAssetManifestResponse } from "../../../src/release-assets/index.js"; import { type ResolvedConfig } from "../config.js"; import { type DeployControlPlane } from "./control-plane.js"; import type { DeployResult } from "./result.js"; export interface DeployProjectRequest { projectDir: string; /** * Explicit project reference for callers that target a project by slug * (for example MCP tools). Takes precedence over receipt, link, and * inference, and never persists a local project link. Requires * `source: { kind: "already-pushed" }` — a request-scoped deploy never * pushes local sources on the caller's behalf. */ projectSlug?: string; branch?: string; environment: string; releaseName?: string; mode: "apply" | "dry-run"; source: { kind: "ensure-pushed"; } | { kind: "already-pushed"; }; } export interface DeployPollingPolicy { assetManifestPollIntervalMs?: number; assetManifestTimeoutMs?: number; environmentPollIntervalMs?: number; environmentTimeoutMs?: number; } export type DeployStepName = "resolve-config" | "push-source" | "resolve-target" | "verify-source" | "create-release" | "verify-release-source" | "wait-release-assets" | "create-deployment" | "verify-deployment" | "wait-environment-url"; export type DeployEvent = { kind: "step"; step: DeployStepName; phase: "started" | "completed"; } | { kind: "warning"; code: "routing-convergence-unconfirmed" | "environment-url-unverified"; message: string; }; export interface DeployObserver { onEvent(event: DeployEvent): void | Promise; } export interface DeployPlan { branch: string; projectId: string | null; projectSlug: string; environment: string; environmentId: string | null; controlPlane: string; plannedActions: Array<"create-project" | "push-source" | "create-release" | "deploy">; } export type DeployProjectOutcome = { kind: "deployed"; result: DeployResult; } | { kind: "dry-run"; plan: DeployPlan; }; export interface DeployProject { execute(request: DeployProjectRequest, observer?: DeployObserver): Promise; } interface DeploymentVerification { projectId: string; projectSlug: string; environmentId: string; environmentName: string; releaseId: string; releaseVersion: string; deploymentId: string; commitSha: string | null; sourceDigest: string; } interface ReleaseSourceVerification { projectId: string; releaseId: string; releaseVersion: string; commitSha: string | null; sourceDigest: string; } interface ReleaseSourceExpectation { projectId: string; releaseId: string; commitSha: string | null; sourceDigest: string; releaseName?: string; } interface DeploymentExpectation { projectId: string; projectSlug: string; environmentId: string; environmentName: string; releaseId: string; deploymentId: string; commitSha: string | null; sourceDigest: string; releaseName?: string; } interface VerificationRetryOptions { attempts?: number; delayMs?: number; } interface DeploymentVerificationOptions extends VerificationRetryOptions { releaseSource?: VerificationRetryOptions; verifiedRelease?: ReleaseSourceVerification; } export declare function assertProjectOwnership(resourceType: "Environment" | "Release", resource: { id: string; projectId?: string; }, projectId: string): void; export declare function resolvePushedSource(input: { projectDir: string; controlPlane: string; projectId: string; projectSlug: string; branch: string; }): Promise<{ commitSha: string | null; sourceDigest: string; }>; export declare function verifyReleaseSource(controlPlane: DeployControlPlane, projectReference: string, expected: ReleaseSourceExpectation, options?: VerificationRetryOptions): Promise; export declare function verifyDeployment(controlPlane: DeployControlPlane, projectReference: string, expected: DeploymentExpectation, options?: DeploymentVerificationOptions): Promise; export declare function waitForReleaseAssetManifest(controlPlane: DeployControlPlane, projectSlug: string, releaseId: string, options?: { expectedRoutes?: string[]; pollIntervalMs?: number; timeoutMs?: number; }): Promise; interface EnvironmentReadinessTarget { projectSlug: string; environmentName: string; url: string; route?: string | null; protected: boolean; apiToken: string; /** * A token bound to this environment, obtained by exchanging `apiToken`, and * sent to the gate in its place. Not a session: the API refuses it as one. */ environmentAccessToken?: string; } /** * What the readiness step actually established about the environment URL. * * `served` is the only outcome in which the app itself was observed answering. * A protected environment challenges an unauthenticated probe at the access * gate, and this CLI cannot get past that gate holding an API key rather than a * session, so `gated` means routing resolves and nothing more: the app behind * it may be answering 503 to every signed-in visitor. Reporting the two the * same way is what lets a broken deployment finish with a green tick. */ export type EnvironmentReadiness = Readonly<{ kind: "served"; }> | Readonly<{ kind: "unprobed"; }> | Readonly<{ kind: "gated"; url: string; status: number; }>; export declare function waitForEnvironmentReady(target: EnvironmentReadinessTarget, options?: { pollIntervalMs?: number; timeoutMs?: number; }): Promise; export declare function createDeployProject(options?: { polling?: DeployPollingPolicy; controlPlaneFactory?: (config: ResolvedConfig) => DeployControlPlane; }): DeployProject; export {}; //# sourceMappingURL=deploy-project.d.ts.map