import type { DevtoolsLogLevel } from "./types.js"; /** Default measured window for the log ring; older lines are evicted, never grown. */ export declare const LOG_BUS_CAPACITY = 200; /** Warnings and errors also land in their own ring, so an error is never pushed out by info traffic. */ export declare const LOG_BUS_SEVERE_CAPACITY = 64; /** Longest kept message; a longer one is cut once, at write time. */ export declare const LOG_BUS_MESSAGE_MAX = 400; /** One captured line: when, how bad, which system said it, and what it said. */ export interface LogBusEntry { at: number; level: DevtoolsLogLevel; /** Owning system tag, e.g. `needs`, `nav`, `render/culling`, `console`. */ system: string; message: string; } /** Lifetime totals per level, plus how many lines the ring dropped. */ export interface LogBusCounts { log: number; info: number; warn: number; error: number; } /** Read-out of the log bus: newest-window entries, the warning/error ring, totals, and evictions. */ export interface LogBusSnapshot { entries: readonly LogBusEntry[]; severe: readonly LogBusEntry[]; counts: LogBusCounts; dropped: number; capacity: number; } /** Tunables for the log ring: capacity, the severity ring's capacity, and the clock. */ export interface LogBusOptions { capacity?: number; severeCapacity?: number; now?: () => number; } /** * A fixed-capacity ring of log lines tagged by owning system. `write` reuses a * preallocated slot — no array growth, no splice, no per-write object — so a hot * path can call it and only the message string (already built by the caller) * costs an allocation. * * @capability devtools-log-bus a bounded, per-system-tagged log ring a system writes to and a report reads */ export interface LogBus { write(level: DevtoolsLogLevel, system: string, message: string): void; /** Oldest-to-newest entries currently held. Allocates once per read. */ list(): readonly LogBusEntry[]; /** Warnings and errors only, oldest first. */ severe(): readonly LogBusEntry[]; counts(): LogBusCounts; dropped(): number; snapshot(): LogBusSnapshot; /** Empty every ring and counter, keeping the allocation. */ reset(): void; } /** Create the bounded log bus the devtools log facade writes through. */ export declare function createLogBus(options?: LogBusOptions): LogBus;