UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

31 lines (30 loc) 1.36 kB
import { type ClientSession } from "#client/session.js"; import type { MessageStreamEvent } from "#protocol/message.js"; import type { StreamOptions } from "#client/types.js"; export interface SessionEventStreamOptions { readonly startIndex?: number; readonly catchUp?: boolean; readonly headers?: Readonly<Record<string, string>>; readonly streamReconnectPolicy?: StreamOptions["streamReconnectPolicy"]; readonly onEvent: (event: MessageStreamEvent) => void; readonly onError: (error: unknown) => void; } /** One transport, with short-lived readers for catch-up and turn completion. */ export declare class SessionEventStream { #private; readonly caughtUp: Promise<void>; constructor(session: ClientSession, options: SessionEventStreamOptions); subscribe(signal?: AbortSignal): SessionEventReader; get ended(): boolean; setOptions(options: Pick<SessionEventStreamOptions, "headers" | "streamReconnectPolicy">): void; close(): void; } export declare class SessionEventReader implements AsyncIterable<MessageStreamEvent>, Disposable { #private; constructor(unsubscribe: () => void, signal?: AbortSignal); push(event: MessageStreamEvent): void; end(error?: unknown): void; [Symbol.dispose](): void; discard(): void; [Symbol.asyncIterator](): AsyncGenerator<MessageStreamEvent>; }