import { type Storage } from '../storage/interface.ts'; import { type Cursor, type FleetEventAppendOptions, type FleetEventEnvelope, type FleetEventFeedOptions, type FleetEventInput, type FleetWorkflowEventInput, type ReplayLiveSubscribeOptions } from './workflow-event-feed.ts'; export type { FleetEventAppendOptions, FleetEventEnvelope, FleetEventFeedOptions, FleetEventGapEnvelope, FleetEventInput, FleetWorkflowEventInput, } from './workflow-event-feed.ts'; /** * Append cross-workflow events, replay history, then subscribe for live delivery. This is the shape * of `HandlerOptions.fleetEventFeed` — build a real one with * `createFleetEventFeed()` to drive `/v1/events/sse` through `handleRequest()` * without `serve()`. * * @example * ```ts * import { Engine, MemoryStorage } from '@lostgradient/weft'; * import { createFleetEventFeed, type FleetEventFeed } from '@lostgradient/weft/server/handler'; * * const engine = new Engine({ storage: new MemoryStorage() }); * const fleetEventFeed: FleetEventFeed = createFleetEventFeed(engine.storage); * void fleetEventFeed; * ``` */ export type FleetEventFeed = { append(event: FleetEventInput, options?: FleetEventAppendOptions): Promise; appendWorkflowEventIfPresent(event: FleetWorkflowEventInput): Promise; replay(options?: { fromCursor?: Cursor; limit?: number; }): AsyncIterable; subscribe(options?: ReplayLiveSubscribeOptions): AsyncIterable; snapshotTailSequence(): Promise; snapshotRetentionFloor(): Promise; retain(options: { beforeSequence: number; limit?: number; }): Promise; dispose(): void; }; /** * Build a `FleetEventFeed` backed by the given `Storage` — typically * `engine.storage` and share it across every fleet transport. * @example * ```ts * import { MemoryStorage } from '@lostgradient/weft'; * import { createFleetEventFeed } from '@lostgradient/weft/server/handler'; * const feed = createFleetEventFeed(new MemoryStorage()); * ``` */ export declare function createFleetEventFeed(storage: Storage, feedOptions?: FleetEventFeedOptions): FleetEventFeed;