/**
 * Server-side polling for Harness pipeline executions.
 *
 * Used by harness_execute when the caller passes `wait: true` so the LLM
 * doesn't have to repeatedly call `harness_get` to check status. One MCP tool
 * call triggers the pipeline and returns when the execution reaches a terminal
 * status (or the timeout fires).
 *
 * Pure logic — receives the Registry + HarnessClient via DI so future callers
 * (e.g. a standalone `wait` execute action on `execution`) can reuse it.
 */
import type { HarnessClient } from "../client/harness-client.js";
import type { Registry } from "../registry/index.js";
/**
 * Statuses Harness considers terminal for a pipeline execution.
 * Anything else (Running, Queued, Paused, *Waiting, etc.) keeps polling.
 *
 * NOTE: `ApprovalWaiting`, `InterventionWaiting`, and `InputWaiting` are NOT
 * terminal — Harness keeps the execution "alive" pending human action. We poll
 * through them so wait blocks until a real outcome.
 */
export declare const TERMINAL_STATUSES: ReadonlySet<string>;
/** Statuses that indicate the execution failed and is worth diagnosing. */
export declare const FAILURE_STATUSES: ReadonlySet<string>;
export interface PollOptions {
    executionId: string;
    orgId?: string;
    projectId?: string;
    /** Hard cap on total wait time. */
    timeoutMs: number;
    /** First poll happens after this delay (gives the execution a moment to start). */
    initialIntervalMs: number;
    /** Backoff cap. */
    maxIntervalMs: number;
    /** Cancel polling when this signal aborts. */
    signal?: AbortSignal;
    /** Notify caller after each poll (progress, logging, etc). */
    onPoll?: (status: string, elapsedMs: number, pollCount: number) => Promise<void> | void;
}
export interface PollResult {
    execution_id: string;
    status: string;
    is_terminal: boolean;
    timed_out: boolean;
    elapsed_ms: number;
    poll_count: number;
    started_at?: string;
    ended_at?: string;
    pipeline: {
        name?: string;
        identifier?: string;
    };
    openInHarness?: string;
}
declare class AbortError extends Error {
    constructor();
}
/**
 * Compute next poll interval using exponential backoff.
 * Capped by maxIntervalMs. Multiplier 1.5 — gentle ramp that still slows
 * polling on long-running deploys.
 */
export declare function nextPollIntervalMs(initialMs: number, maxMs: number, pollCount: number): number;
/**
 * Poll a pipeline execution until it reaches a terminal status or the timeout fires.
 *
 * Errors during individual polls are tolerated for a few attempts (logged at
 * warn level) — Harness sometimes returns 5xx for a few seconds while an
 * execution is spinning up, and that shouldn't fail the whole wait.
 *
 * If the signal aborts, the function rejects with an AbortError so callers
 * can surface a "cancelled by client" message.
 */
export declare function pollExecutionToTerminal(registry: Registry, client: HarnessClient, opts: PollOptions): Promise<PollResult>;
export { AbortError };
//# sourceMappingURL=poll-execution.d.ts.map