import type { Cuid2, EventCursor, Timestamp } from "./protocol/common.js"; import type { EventStreamFrame, EventStreamOptions, HappyAgentEvent } from "./protocol/events.js"; /** Options for the client's reconnecting event feed. */ export interface HappyAgentUpdatesOptions { /** The last event the caller has already applied. */ after?: EventCursor | undefined; /** Stops reconnecting and ends the iteration. */ signal?: AbortSignal | undefined; } /** One item from the client's reconnecting event feed. */ export type HappyAgentUpdate = { kind: "connected"; cursor: EventCursor; } | { kind: "daemon_started"; cursor: EventCursor; daemonId: Cuid2; daemonStartedAt: Timestamp; /** `true` when this replaces a daemon already observed by this iterator. */ replaced: boolean; } | { kind: "draining"; cursor: EventCursor; daemonId?: Cuid2; } | { kind: "state_lost"; cursor: EventCursor; } | { kind: "disconnected"; cursor?: EventCursor; } | { kind: "event"; event: HappyAgentEvent; cursor: EventCursor; }; type OpenEventStream = (options: EventStreamOptions) => AsyncIterable; /** * Follows the global event stream until the caller aborts it. * * The accepted cursor advances before an event is yielded, so every reconnect * starts strictly after the last event visible to the caller. A resumed * stream's hello names the daemon's current head, not the start of its replay, * so that value replaces the accepted cursor only for a fresh stream or after * an honest gap. */ export declare function reconnectingUpdates(openEventStream: OpenEventStream, options?: HappyAgentUpdatesOptions): AsyncGenerator; export {}; //# sourceMappingURL=updates.d.ts.map