import { GuildAPIClient } from './api-client.js';
import { SessionEvent } from './session-events.js';
export interface PollResult {
    response: string | null;
    /** Last event ID seen — pass as `afterEventId` on next call. */
    lastEventId: string | undefined;
}
export interface PollOnceResult {
    events: SessionEvent[];
    lastEventId: string | undefined;
    reason: 'completion' | 'error' | 'ui_prompt' | 'inactivity_timeout';
}
/**
 * Poll for agent response using WebSocket streaming with HTTP fallback.
 *
 * Does one initial HTTP GET (using from_id cursor) to check if the response
 * is already available, then opens a WebSocket for real-time events.
 * Falls back to HTTP polling if the WebSocket connection fails.
 *
 * Handles both multi-turn agents (which emit agent_notification_message)
 * and one-shot agents (which may only emit runtime_done with output content).
 *
 * Priority:
 * 1. root agent_notification_message — preferred, immediate return
 * 2. root runtime_error — fail fast
 * 3. root runtime_done content — fallback for one-shot agents
 * 4. root done response-stream after root runtime_done — streaming fallback
 */
export declare function pollForResponse(client: GuildAPIClient, sessionId: string, afterEventId: string | undefined, maxWaitTime?: number): Promise<PollResult>;
/**
 * Poll for agent response while streaming matching events to stdout as JSONL.
 *
 * Same completion logic as pollForResponse(), but writes each event that
 * passes the filter to stdout so callers get intermediate output (console.log,
 * progress, etc.) in JSON/JSONL automation modes.
 *
 * Uses HTTP polling (not WebSocket) since it needs to emit each event
 * individually to stdout as JSONL.
 */
export declare function pollForResponseWithEvents(client: GuildAPIClient, sessionId: string, eventFilter: Set<string>, afterEventId: string | undefined, maxWaitTime?: number): Promise<PollResult>;
/**
 * Poll for --once mode using WebSocket streaming with HTTP fallback.
 *
 * Accumulates all events (unlike pollForResponse which returns a single response)
 * and checks for completion conditions after each batch.
 */
export declare function pollForOnce(client: GuildAPIClient, sessionId: string, options?: {
    inactivityTimeoutMs?: number;
    pollIntervalMs?: number;
}): Promise<PollOnceResult>;
//# sourceMappingURL=session-polling.d.ts.map