/** * Singleton gate for stream debug logging. * * WireAdapter reads this on every stream() call, so runtime toggles * (via /settings debug-stream on|off) take effect on the next request * without recreating provider instances. * * When enabled, WireAdapter accumulates per-chunk stats and pushes them * through a registered callback. In CLI (non-TUI) mode the default * callback writes a compact status line to stderr. The TUI replaces * the callback with one that dispatches to its reducer so the debug * info renders inside Ink's StatusBar line 3 instead of bypassing it. * * The CLI boot path seeds this from config.debugStream at startup. */ export interface DebugStreamStats { /** Monotonic chunk counter, resets per-stream. */ chunkCount: number; /** Bytes of the most recent chunk. */ lastChunkSize: number; /** Millisecond delta since the PREVIOUS chunk (reveals think gaps). */ lastDeltaMs: number; /** Cumulative bytes received for this stream. */ totalBytes: number; /** ISO timestamp of the most recent chunk. */ lastChunkAt: string; } export type DebugStreamCallback = (stats: DebugStreamStats) => void; /** Check whether raw SSE stream debugging is currently active. */ export declare function isDebugStreamEnabled(): boolean; /** Flip the stream debug flag at runtime. Persisted separately via ConfigStore. */ export declare function setDebugStreamEnabled(enabled: boolean): void; /** * Register a callback that receives THROTTLED debug-chunk stats (~5 Hz). * WireAdapter calls `pushDebugChunkStats()` on every raw chunk; this module * batches them and calls `cb` at most once per THROTTLE_MS. * * Pass `null` to restore the default stderr behaviour. */ export declare function setDebugStreamCallback(cb: DebugStreamCallback | null): void; /** * Called by WireAdapter on every raw chunk. Not throttled — call it as * often as chunks arrive; it's cheap (a few integer assigns + a debounced * setTimeout). The registered callback receives aggregated stats at most * once per THROTTLE_MS. */ export declare function pushDebugChunkStats(bytes: number, deltaMs: number): void; /** * Default callback: write a compact status line to stderr (used in CLI / * headless mode where Ink isn't painting the terminal). */ export declare function defaultDebugStreamCallback(stats: DebugStreamStats): void; //# sourceMappingURL=stream-debug-state.d.ts.map