import type { Retry } from "@renderinc/sdk/workflows"; /** * The poll-by-throwing primitive. SDK 0.6.0 has no native sleep/await, so a * durable "wait until X" is expressed as: run a check, `throw` if the condition * is not met yet, and let a fixed-interval durable retry (see {@link awaitRetry}) * re-run the task until it is. These helpers hold that pattern in one place so * every awaiter/gate task reads the same and can't drift. */ /** * Presence poll: await `fn`, return its value if truthy, otherwise `throw` the * given message so the durable retry re-runs the task. Serves the "wait until a * thing appears" tasks (`http.poll`, `email.awaitReply`, `slack.awaitReaction`, * `discord.awaitButton`). The caller maps the returned value into its own DTO. */ export declare function pollUntil(fn: () => Promise, message: string): Promise>; /** Outcome of a {@link pollGate} check. */ export type GateState = "wait" | "fail" | "done"; /** * Tri-state gate for "do X once a condition resolves". Unlike a boolean poll it * distinguishes *keep waiting* from *give up and alert a human*: * - `"wait"` → throw `waitMessage` so the durable retry re-polls; * - `"fail"` → throw `failMessage`, a distinct error a human should see rather * than a silent forever-retry or a wrong side effect; * - `"done"` → run `onDone` and return its result. * * Serves the merge-gate tasks (`github.mergeWhenGreen`, `gitlab.mergeWhenGreen`). */ export declare function pollGate(opts: { state: () => Promise; onDone: () => Promise; waitMessage: string; failMessage: string; }): Promise; /** * Build a fixed-interval durable retry policy from a cadence — the "poll every * `everyMs` for up to `forMs`" that the await/poll tasks need. This is * mechanical cadence, not vendor tuning, so it lives here; the per-vendor * general retry policies stay in each package's `retry.ts` (ADR-0005). */ export declare function awaitRetry(opts: { everyMs: number; forMs: number; }): Retry; //# sourceMappingURL=poll.d.ts.map