import { type RunStuckState } from "./use-run-stuck-detection.js"; /** * Surface a user-visible affordance when a chat run hasn't emitted any * events for an unusually long time. The adapter's silent reconnect logic * keeps trying in the background; this banner is the fallback when those * attempts haven't restored progress and the user is staring at a frozen * spinner. */ export interface RunStuckBannerProps { /** The thread to monitor. Pass null/undefined to disable. */ threadId: string | null | undefined; /** * Set false to skip polling entirely — used when this banner is mounted * for a background tab kept alive via display:none. Only the active tab * should poll `/runs/active`. Defaults to true. */ enabled?: boolean; /** API base path. Default `/_agent-native/agent-chat`. */ apiUrl?: string; /** * Threshold above which an in-flight run is considered stuck. * Defaults to 90s (after the adapter's 75s no-progress reconnect * has had a chance to recover). */ stuckThresholdMs?: number; /** * Called when the user clicks Retry. Implementations should re-prompt * the agent (typically via `chatHandle.sendMessage(...)`) — the banner * itself only handles aborting the prior run. */ onRetry?: (runId: string) => void; /** * Returns true when the run has a tool call or sub-agent (A2A) call that * hasn't returned a result yet — typically backed by * `chatHandle.hasInFlightWork()`. "No progress" for a stretch of time does * not mean the run is dead: a long provider query or a cross-app `call * agent` can legitimately emit nothing for minutes. When this returns * true, the stuck warning is hidden — aborting would destroy real in-flight * work and re-execute the same long call from scratch. Checked fresh on every * render; omit to keep the unconditional Retry/Cancel behavior. */ hasInFlightWork?: () => boolean; /** * Called whenever the stuck state transitions. Useful for surfacing * observability events (Sentry, PostHog) at the call site. */ onStuckStateChange?: (state: RunStuckState) => void; /** * Automatically abort and retry once when the server reports a run is * alive but has stopped making real progress. Manual controls remain visible * as the fallback if the automatic recovery cannot clear the run. */ autoRetry?: boolean; /** * Stable browser-tab/window id used to coordinate automatic retries across * multiple mounted chat views for the same thread. A local id is generated * when omitted. */ autoRetryOwnerId?: string; /** Extra class on the outer container. */ className?: string; } export declare function RunStuckBanner({ threadId, enabled, apiUrl, stuckThresholdMs, onRetry, onStuckStateChange, autoRetry, autoRetryOwnerId, hasInFlightWork, className, }: RunStuckBannerProps): import("react").JSX.Element | null; //# sourceMappingURL=RunStuckBanner.d.ts.map