import type { AgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
export type StreamState = {
    readonly stage: "idle";
} | {
    readonly stage: "connecting";
    readonly executionId: string;
} | {
    readonly stage: "streaming";
    readonly executionId: string;
} | {
    /**
     * A non-terminal stream drop is being retried in the background. The
     * last-known-good snapshot stays visible and no error is surfaced —
     * the public `error` only appears once retries are exhausted. `attempt`
     * is the 1-based retry count; `error` is the transient cause, retained
     * for diagnostics (it is not shown to the user while reconnecting).
     */
    readonly stage: "reconnecting";
    readonly executionId: string;
    readonly attempt: number;
    readonly error: Error;
} | {
    readonly stage: "complete";
    readonly executionId: string;
} | {
    readonly stage: "error";
    readonly executionId: string;
    readonly error: Error;
};
type Listener = () => void;
/**
 * Framework-agnostic store that holds the active execution snapshot
 * with structural sharing. Implements the contract required by
 * React's `useSyncExternalStore`.
 *
 * - `ingestSnapshot` applies structural sharing so unchanged nested
 *   entities keep their previous reference.
 * - Listeners are notified only when state actually changes.
 * - `getExecution` and `getStreamState` return stable references
 *   suitable as `useSyncExternalStore` snapshot selectors.
 */
export declare class ConversationStore {
    private _execution;
    private _streamState;
    private _connectTimedOut;
    private _isSlow;
    private _listeners;
    /**
     * Ingest a new execution snapshot. Applies structural sharing
     * against the previous snapshot and notifies listeners only if
     * the resulting reference changed.
     */
    ingestSnapshot(snapshot: AgentExecution): void;
    /**
     * Transition the stream lifecycle state. Notifies listeners only
     * when the stage or executionId actually changes.
     */
    setStreamState(state: StreamState): void;
    /**
     * Set the hard connect-timeout signal — the stream opened but no first
     * snapshot arrived within the watchdog window even after a silent retry.
     *
     * Orthogonal to {@link setStreamState}: the stream may still be live, so
     * this is **not** a lifecycle stage and deliberately does not touch the
     * `error` stage (that is auto-reconnect's domain). Booleans are stable by
     * value, so no snapshot caching is needed; listeners fire only on change.
     */
    setConnectTimedOut(value: boolean): void;
    /**
     * Set the soft slow-stall hint — the stream is non-terminal but has gone
     * silent past the watchdog window. Purely informational ("still working,
     * taking longer than usual"); cleared by the next snapshot. Never aborts.
     */
    setSlow(value: boolean): void;
    /**
     * Reset to initial state. Used when the session identity changes
     * or the hook unmounts.
     */
    reset(): void;
    /**
     * Subscribe a listener that is called whenever any store state
     * changes. Returns an unsubscribe function.
     */
    subscribe: (listener: Listener) => (() => void);
    /** Stable snapshot selector for the current execution. */
    getExecution: () => AgentExecution | null;
    /** Stable snapshot selector for the stream lifecycle state. */
    getStreamState: () => StreamState;
    /** Stable snapshot selector for the hard connect-timeout signal. */
    getConnectTimedOut: () => boolean;
    /** Stable snapshot selector for the soft slow-stall hint. */
    getSlow: () => boolean;
    private _notify;
}
export {};
//# sourceMappingURL=conversation-store.d.ts.map