/** * Approval Poller * * SDK-internal handler for await_approval steps. * Automatically polls for approval status until completion, error, or timeout. * * Features: * - Respects pollInterval from the server * - Stops polling when expiresAt is reached * - Supports cancellation via AbortController */ import type { AwaitApprovalStep, WireResponse } from "../protocol"; export interface PollerConfig { /** Function to send a poll action and get response */ sendPoll: (signal?: AbortSignal) => Promise; /** Called when polling completes (success or error) */ onComplete: (response: WireResponse) => void; /** Called on polling errors */ onError: (error: Error) => void; /** AbortSignal for cancellation */ signal?: AbortSignal; } export interface ApprovalPollerResult { /** Whether polling completed successfully */ completed: boolean; /** Final response (if completed) */ response?: WireResponse; /** Error (if failed) */ error?: Error; /** Reason for stopping */ reason: "completed" | "expired" | "cancelled" | "error"; } /** * Poll for approval status until completion, expiration, or cancellation. * * @param step - The await_approval step from the server * @param config - Polling configuration * @returns Result of the polling operation */ export declare function pollForApproval(step: AwaitApprovalStep, config: PollerConfig): Promise; /** * Create an AbortController-based poller that can be cancelled. */ export declare function createApprovalPoller(step: AwaitApprovalStep, sendPoll: (signal?: AbortSignal) => Promise): { start: () => Promise; cancel: () => void; };