/** * How long the client keeps polling a mirror that answers 'syncing'. * Must outlast the server's own worst case: 180s shared-lock wait + 180s * capture-lease wait + checkout materialization (git switch, dependency * install, preview boot). 420s gives that chain a minute of headroom. */ export declare const MIRROR_SYNC_POLL_TIMEOUT_MS = 420000; /** * Poll cadence while the mirror sits idle. * * Idle means nobody has asked for the checkout yet, and the ask can come from * outside this editor's own controls — a frame requesting its capture reaches * the server directly. The server has no way to tell the page that the work it * triggered has landed, so an idle mirror is watched rather than assumed * settled. This only reads status; it never orders a checkout. */ export declare const MIRROR_IDLE_POLL_INTERVAL_MS = 2000; /** Poll cadence while the mirror reports 'syncing'. */ export declare const MIRROR_SYNC_POLL_INTERVAL_MS = 500; /** First automatic boot-retry delay after a failed refresh. */ export declare const MIRROR_BOOT_RETRY_BASE_MS = 5000; /** Ceiling for the boot-retry backoff. */ export declare const MIRROR_BOOT_RETRY_MAX_MS = 30000; /** Delay before automatic boot retry `attempt` (0-based): 5s, 10s, 20s, then 30s forever. */ export declare function mirrorBootRetryDelayMs(attempt: number): number; /** The slice of the mirror status the gate decides on. */ export interface MirrorGateStatus { state: string; } /** The idle status fields that can identify an immutable source before checkout. */ export interface IdleMirrorSourceStatus extends MirrorGateStatus { sourceRef: string | null; } /** One listed ref whose exact revision can start a lazy checkout. */ export interface IdleMirrorListedSourceRef { name: string; fullName?: string; sourceRevision?: string; } /** The ref-list fields needed to resolve an idle named source. */ export interface IdleMirrorSourceRefs { refs: readonly IdleMirrorListedSourceRef[]; defaultRef: string | null; worktreeRef?: string | null; } /** * Returns an immutable source revision that can safely create the first lazy * preview demand. * * An idle mirror has no checked-out `commit` yet. When it was configured with * a full Git object id, however, that ref already names the exact revision the * catalog endpoint will verify after preparation. A named ref can also create * that first demand when the ref-list endpoint supplies its full object id. * The abbreviated display commit is intentionally ignored: it can be * ambiguous and cannot satisfy the exact source lease. */ export declare function idleMirrorSourceRevision(status: IdleMirrorSourceStatus, sourceRefs?: IdleMirrorSourceRefs): string | null; export interface SettleMirrorStatusOptions { /** Status of the initial request; returned as-is when already settled. */ initial: S; /** One GET of the mirror status endpoint. */ fetchStatus: () => Promise; /** One POST to the mirror refresh endpoint; resolves with the post-sync status. */ requestResync: () => Promise; timeoutMs?: number; intervalMs?: number; /** Test seams. */ now?: () => number; sleep?: (ms: number) => Promise; } /** * Settles the mirror status a boot can act on. * * 'syncing' is polled through — the server is alive and working, and its own * lock waits exceed two minutes, so giving up earlier than MIRROR_SYNC_POLL_- * TIMEOUT_MS misreads a busy server as a dead one. 'drifted' asks the server * to resync exactly once: drift means another server moved the shared * checkout, and one refresh re-materializes the ref this server serves. * * Returns the first status that is neither, or the last observed status when * the window closes. The caller decides whether that status is fatal. */ export declare function settleMirrorStatus(options: SettleMirrorStatusOptions): Promise;