/** * A log entry stored in the ring buffer. * @internal */ export interface LogEntry { level: number; time: number; msg: string; [key: string]: unknown; } /** * Callback for newly-stored log entries. See {@link LogBuffer.subscribe}. * @internal */ export type LogBufferListener = (entry: LogEntry) => void; /** * Query options for filtering log entries. * @internal */ export interface LogQuery { /** Filter by automation name. */ automation?: string; /** Filter by minimum log level (pino numeric: 10=trace, 20=debug, 30=info, 40=warn, 50=error, 60=fatal). */ level?: number; /** Maximum number of entries to return (default: 50). */ limit?: number; } /** * In-memory ring buffer for storing recent log entries. * * Implements a writable stream interface compatible with pino's * multistream destination. Stores the last N log entries and supports * filtered queries by automation name and log level. * * @internal */ export declare class LogBuffer { private readonly buffer; private writeIndex; private count; private readonly capacity; /** Subscribers notified of each newly-stored entry (design.md D32; task 5.0). */ private readonly listeners; constructor(capacity?: number); /** * Write a log chunk (called by pino's stream). * * A single chunk may contain multiple newline-delimited JSON objects (as pino * may deliver batched writes). Each non-empty line is parsed independently and * stored; a single malformed line is skipped without dropping the others. * * Newly-stored entries are announced to subscribers (see {@link subscribe}), * but never synchronously: notification is deferred to a later turn of the * event loop (design.md D32, R9; task 5.0a), so `write()` — which every * `logger.*` call in the engine reaches via pino's sink — always returns * before any listener runs. This keeps whatever a listener does (including * fanning out to network connections) off the hot, synchronous logging path. */ write(chunk: string): boolean; /** * Subscribe to newly-stored log entries. * * Returns an unsubscribe function that releases the listener and retains no * reference to it. A listener that throws does not prevent storage (storage * already happened by the time listeners run) and does not stop the * remaining listeners from being notified. */ subscribe(listener: LogBufferListener): () => void; /** Notify every subscriber of one entry, isolating a throwing listener. */ private notify; /** * Query log entries with optional filters. * * Returns entries in chronological order (oldest first). */ query(options?: LogQuery): LogEntry[]; } //# sourceMappingURL=log-buffer.d.ts.map