import type { ActiveLogExporterMode } from '../telemetry-config.js'; import { type DaemonLogSinkDeps, type RemoteLogShipper } from './log-sink.js'; export declare const DEFAULT_FATAL_LOG_DRAIN_TIMEOUT_MS = 2000; /** * Fatal exceptions must not leave a broken daemon alive because its log file * is stuck. Detach all producers, give accepted writes one short best-effort * drain window, then invoke the exit callback regardless of the outcome. */ export declare function exitAfterFatalLogDrain(opts: { detach: () => void; shutdown: () => Promise; exit: (code: number) => void; timeoutMs?: number; reportTimeout?: (message: string) => void; }): Promise; interface DaemonLogExporter { mode: ActiveLogExporterMode; shipper: RemoteLogShipper; shutdown: () => Promise; } export type DaemonLogExporterStartResult = { ok: true; started: boolean; } | { ok: false; error: string; }; export interface DaemonLogController { startExporter(mode: ActiveLogExporterMode, factory: () => Omit): DaemonLogExporterStartResult; stopExporter(): Promise; detachSink(): void; } /** * Own the daemon Logger sink and the active shipper it reads. TelemetryRuntime * is the sole caller that starts/stops the exporter; daemon shutdown calls * detachSink() synchronously, then lets that runtime perform the final flush. * Database maintenance lives in dashboard-log-volume-pruner.ts. */ export declare function startDaemonLogController(opts: { writeLocalDebug: DaemonLogSinkDeps['writeLocalDebug']; insertDiagnosticLog: DaemonLogSinkDeps['insertDiagnosticLog']; redact: DaemonLogSinkDeps['redact']; }): DaemonLogController; export {}; //# sourceMappingURL=log-lifecycle.d.ts.map