import type { FactoryEvent } from "@you-agent-factory/client"; export type FactoryEventSinkErrorCode = "capacity_exceeded" | "closed" | "duplicate_event_id" | "empty_batch" | "invalid_capacity" | "invalid_event_order" | "invalid_recording" | "mixed_factory_identity" | "mixed_session_identity"; export declare class FactoryEventSinkError extends Error { readonly code: FactoryEventSinkErrorCode; constructor(code: FactoryEventSinkErrorCode, message: string); } /** Caller-owned destination for one ordered, atomic Factory Event batch. */ export interface FactoryEventSink { write(events: readonly FactoryEvent[]): Promise; /** Optional lifecycle boundary used when an emulator session closes. */ close?(): Promise; } export interface MemoryFactoryEventSinkOptions { /** Maximum number of events retained. A batch that crosses this bound fails whole. */ readonly maxEvents: number; /** Optional asynchronous boundary for backpressure or caller-controlled failure injection. */ readonly beforeWrite?: (events: readonly FactoryEvent[]) => Promise; } /** * Bounded, caller-owned event history. Concurrent writes are processed in call * order, and one rejected write does not prevent a later write or retry. */ export declare class MemoryFactoryEventSink implements FactoryEventSink { #private; constructor(options: MemoryFactoryEventSinkOptions); write(events: readonly FactoryEvent[]): Promise; snapshot(): readonly FactoryEvent[]; close(): Promise; }