/** * The bounded ring one plugin's backend writes through `ctx.emit`, read back by * cursor over polling and over the events socket. * * In memory and per process by design: this is the channel a plugin's own UI * watches, not a record anything may depend on. The cursor is what makes polling * a complete fallback for the socket, so a client that can only poll still sees * every event the ring still holds. */ /** How many events one plugin retains. Past this the oldest are dropped, and a * reader whose cursor predates the oldest survivor is told so rather than * handed a silent gap. */ export declare const PLUGIN_EVENT_RING_SIZE = 200; export interface PluginEventRecord { /** Strictly increasing per plugin for the life of the process. Never reused, * and never reset when the ring wraps — a cursor names a position in the * plugin's whole emission history, not a slot in the buffer. */ cursor: number; event: unknown; } export interface PluginEventPage { events: PluginEventRecord[]; /** What to ask for next. The newest cursor this plugin has reached, which is * the last of `events` whenever the page is not empty. */ cursor: number; /** True when events after the caller's cursor were evicted before it read * them. The caller has a gap, and saying so beats letting it assume it does * not. */ dropped: boolean; } type PluginEventListener = (record: PluginEventRecord) => void; /** * Append one event to a plugin's ring and hand it to that plugin's subscribers. * * Listener errors are not caught here: the only subscriber is the events socket, * which guards its own send, and swallowing here would hide a gateway bug inside * a plugin's call to `emit`. */ export declare function appendPluginEvent(id: string, event: unknown): void; /** This plugin's events after `since`, or its whole retained buffer when the * caller has no cursor yet. */ export declare function readPluginEvents(id: string, since?: number): PluginEventPage; /** Follow one plugin's appends. The returned function unsubscribes. */ export declare function subscribePluginEvents(id: string, listener: PluginEventListener): () => void; export {}; //# sourceMappingURL=event-log.d.ts.map