/** Same path the Fleet reader pulls (apps/ext/src/core/watchdogLog.ts). */
export declare const WATCHDOG_LOG_PATH: string;
/** Kinds the Factory reader accepts. Keep in lockstep with watchdogLog.ts. */
export type WatchdogEventKind = 'tick' | 'decision' | 'nudge' | 'undelivered' | 'rotate' | 'error';
/** JSONL row shape — a verbatim replica of the Factory reader's WatchdogEvent. */
export interface WatchdogEvent {
    ts: number;
    kind: WatchdogEventKind;
    terminalId?: string;
    agentType?: string;
    message: string;
    reason?: string;
    /** For 'tick' events: the session lines the watchdog actually read. */
    tailLines?: string[];
    /** For 'tick' / 'decision' events: how long the terminal had been stalled. */
    stalledForMs?: number;
    /** Carried so the UI can show what the agent was stuck on. */
    lastUserMessage?: string;
    lastAssistantMessage?: string;
    /** For a 'decision'/'nudge' that injects: the exact text delivered. */
    nudgeText?: string;
    /** Compact per-session evaluations carried by heartbeat ticks. */
    inspections?: WatchdogInspection[];
}
export interface WatchdogInspection {
    terminalId?: string;
    agentType: string;
    message: string;
    reason: string;
    stalledForMs?: number;
}
/** Parse the audit log without letting a partial final append hide valid rows. */
export declare function parseWatchdogEvents(text: string): WatchdogEvent[];
export declare function readWatchdogEvents(logPath?: string): WatchdogEvent[];
/** Serialize one event to a JSONL line (no trailing newline). */
export declare function formatEvent(ev: WatchdogEvent): string;
/**
 * Cap on retained log lines. Mirrors the Factory reader's expectation that the
 * writer trims (watchdogLog.ts trimToLast). Large enough to keep a useful
 * history, small enough to bound the file the UI polls.
 */
export declare const WATCHDOG_LOG_MAX_LINES = 5000;
export declare const WATCHDOG_TAIL_MAX_CHARS = 4096;
/** Keep the newest transcript context without letting it consume the audit window. */
export declare function boundTailLines(lines: string[], maxChars?: number): string[];
/** Trim a JSONL body to the last `maxLines` events (same logic as the reader). */
export declare function trimToLast(text: string, maxLines: number): string;
/**
 * Append events to the log under a file lock, trimming to WATCHDOG_LOG_MAX_LINES
 * so the file never grows unbounded. Concurrent watchdog ticks share the lock so
 * their appends never interleave into a corrupt line. Best-effort: a filesystem
 * error is swallowed (the Factory card tolerates a stale/missing log), never
 * throwing into the tick.
 */
export declare function appendWatchdogEvents(events: WatchdogEvent[], opts?: {
    logPath?: string;
    maxLines?: number;
}): void;
