export type DiagnosticKind = 'crash' | 'unhandled_rejection' | 'harness_failure' | 'wake_failure' /** A spawned session never reached session:start (WSH/ABI/missing CLI). */ | 'spawn_failure' /** A wake was deliberately skipped (quiet hours / priority gate). */ | 'wake_skipped' | 'auth_invalid' | 'folder_blocked' | 'api_unreachable' | 'tool_failure' | 'doctor' | 'other'; export type DiagnosticSeverity = 'fatal' | 'error' | 'warning'; export interface DiagnosticInput { kind: DiagnosticKind; severity: DiagnosticSeverity; message: string; errorCode?: string; stack?: string; /** Defaults to the first configured agent. */ agentId?: string; context?: Record; /** Include a local-only `doctor` snapshot (fatal + manual reports). */ includeDoctor?: boolean; /** Pre-built doctor snapshot to attach (manual `doctor --report`). */ doctorReport?: string; } /** Records a line for future diagnostic reports (called from daemon `log()`). */ export declare function pushLogLine(line: string): void; /** Recent log lines (newest last), bounded for the report payload. */ export declare function recentLogLines(max?: number): string[]; /** * Diagnostic report. Never throws; queues when offline or unauthenticated and * skips repeats of the same fingerprint within cooldown. Returns true when the * report was DELIVERED (false = queued/cooldown-skipped). */ export declare function reportDiagnostic(input: DiagnosticInput): Promise; /** Sync wrapper for log/catch sites that must not await. */ export declare function reportDiagnosticSafe(input: DiagnosticInput): void; /** Flushes queued offline reports (best-effort; stops at the first failure). */ export declare function flushDiagnosticQueue(): Promise; /** * Classifies a daemon.log line into a reportable diagnostic, or null. Kept * deliberately narrow so ordinary progress lines never generate reports. */ export declare function diagnoseLogLine(line: string): { kind: DiagnosticKind; severity: DiagnosticSeverity; message: string; includeDoctor?: boolean; } | null; /** Auto-report a raw daemon log line when it matches a known failure. */ export declare function reportFromLogLine(line: string): void;