/** * L2 — the EventLog: the kernel's single truth (ADR-0002). * * Every event the loop yields passes through here. `seq` is assigned HERE, * and only here: an adapter's seq is a "stream-local ordering hint" that this * log re-asserts, because the loop interleaves adapter events with its own * (tool_result, terminal). One allocator, monotonic by construction — there * is no second copy of history to desync, and a trajectory is the replay of * seq 0..N. */ import type { Event } from "../protocol/events.js"; /** * An event without its seq — what producers emit. * * Distribution note: conditional types only distribute over a BARE type * parameter — `Event extends unknown ? Omit : never` does NOT * distribute (Event is a concrete alias, not a parameter) and collapses the * union to its common keys. Wrapping the union in a generic parameter is * what keeps each variant's own fields (callId, outcome, text, ...). */ type DistributiveOmit = T extends unknown ? Omit : never; export type EventInput = DistributiveOmit; export declare class EventLog { #private; /** * A log may be seeded with an existing trajectory (a session rebuilt * from disk, Phase C). The seed is STRICTLY validated: seq must be * exactly 0..N. A gap or duplicate means the trajectory is damaged — * the array length must never mask it (Area 1). Numbering continues * after the seed; `seq` remains the single allocator from here on. */ constructor(initial?: readonly Event[]); /** * Append an event; assigns the authoritative seq and returns it. * `seq` is assigned HERE and only here — a producer's seq is a * stream-local hint, never trusted (ADR-0002). */ append(ev: EventInput): Event; get all(): readonly Event[]; /** * Incremental view for consumers that already saw `seq` and before — * STRICTLY after, so a poll loop delivers each event exactly once. A * consumer that has seen nothing passes -1. (SC-1b ④: this filtered * `>= seq` and re-served the seam event on every poll.) */ since(seq: number): readonly Event[]; get lastSeq(): number; } export {};