import type { CdkOptions } from "./CdkServiceTypes.js"; /** CDK's fixed toolkit stack name for the default qualifier. */ export declare const TOOLKIT_STACK_NAME = "CDKToolkit"; /** Poll cadence while waiting for a concurrent bootstrap to settle. */ export declare const TOOLKIT_SETTLE_POLL_INTERVAL_MS = 5000; /** * Overall budget for waiting on a concurrent bootstrap. The toolkit stack is * a handful of resources — a healthy bootstrap settles well inside this. */ export declare const TOOLKIT_SETTLE_BUDGET_MS = 240000; /** * Lost-race retries after the initial attempt. A no-force retry * short-circuits in seconds when the winner already converged the toolkit, * and a forced retry covers the winner having stamped a different tag set. */ export declare const MAX_BOOTSTRAP_LOST_RACE_RETRIES = 2; export type ToolkitStackState = { kind: "absent"; } | { kind: "in-progress"; status: string; } | { kind: "healthy"; status: string; tags: Record; } | { kind: "unhealthy"; status: string; } | { kind: "unknown"; }; export interface ToolkitProbeParams { region: string; credentials?: CdkOptions["credentials"]; abortSignal?: AbortSignal; } /** * Describe the CDKToolkit stack and classify its state. Never throws — a * probe failure (network, permissions) classifies as `unknown`, which the * force decision treats conservatively. */ export declare function probeToolkitStack(params: ToolkitProbeParams): Promise; export interface ToolkitSettleOptions { pollIntervalMs?: number; budgetMs?: number; /** Injectable clock for budget tests. */ now?: () => number; } /** * Poll the toolkit stack until it reaches a definitively settled state * (absent, healthy, unhealthy), the budget expires, or the abort signal * fires. An `unknown` probe does NOT exit the wait — DescribeStacks * throttling is likeliest under exactly the concurrent load this protocol * targets, and a single throttled poll must not vacate the settle gate. * Returns the final observed state — still `in-progress` (or `unknown`) on * budget exhaustion, so callers decide how to surface that. */ export declare function awaitToolkitSettled(params: ToolkitProbeParams, options?: ToolkitSettleOptions): Promise; /** * Drop empty-key/empty-value tag entries. The CDK CLI parses degenerate * `--tags =v` / `k=` args fine — it is CloudFormation that rejects them. * Shared by the runner's argv emission AND the service's force decision so * both sites compare the same emitted set (coupled at 2 occurrences). */ export declare function filterBootstrapTagEntries(tags: Record | undefined): Record; /** * The force decision: `--force` is emitted iff there are tags to stamp AND * the live stack cannot be confirmed to already carry exactly that set. * Parity is exact record equality — an extra live tag forces a restamp, * preserving the REPLACE contract's "complete set or nothing" semantics. * * Without desired tags there is nothing `--force` buys: creation ignores it, * and CDK upgrades an outdated toolkit without it. */ export declare function resolveBootstrapForce(state: ToolkitStackState, desiredTags: Record | undefined): boolean; /** * Discriminated failure for CdkCommandRunner.bootstrap: `lost-race` means a * concurrent bootstrap won the fixed-name changeset and the protocol should * wait for it to settle and retry; `other` carries the analysed error. * Messages are pre-masked at construction: the lost-race arm interpolates * identifiers only, and the `other` arm analyses runCdkCommand's failure * string, whose sole stderr-bearing arm masks at source (the close-handler * `maskSensitiveOutput(fullError)` in CdkProcessManager) — every other arm * is identifier-only. */ export interface BootstrapRunFailure { kind: "lost-race" | "other"; message: string; } /** * Classify RAW bootstrap stderr as a lost concurrent-bootstrap race. Must run * BEFORE analyseBootstrapError, which reformats the output and destroys the * signatures. */ export declare function isBootstrapLostRaceError(stderr: string): boolean;