/**
 * Daemon log tail reader — read the last N bytes of a daemon log file, newest
 * bytes first, bounded so the result is safe to ship over a mesh P2P channel.
 *
 * Used by the mesh `get_mesh_node_logs` command: the coordinator asks a (possibly
 * remote) daemon for its recent log tail instead of having to open a session and
 * grep the file by hand. Because the mesh RPC envelope is sent as a single
 * datachannel message (~256KB SCTP ceiling, no chunking), the returned tail is
 * HARD-bounded by `tailBytes` (default 64KB, capped at MAX_TAIL_BYTES=128KB) and
 * flags `truncated:true` when more content existed than fit.
 *
 * Two read modes:
 *  - No filter (no grep/sinceMs): byte-bounded tail of the active file — read the
 *    last `tailBytes` bytes only. Cheap, backward-compatible.
 *  - Filtered (grep and/or sinceMs given): FULL-FILE scan. The filter is applied
 *    across the ENTIRE file (plus the size-rotation `.1.log` backup) BEFORE the
 *    byte cap, then the last `tailBytes` worth of MATCHING lines are returned.
 *    This is the fix for "matches hidden behind polling spam": when the recent
 *    tail window is saturated with high-frequency lines (e.g. coordinator polling
 *    `get_pending_mesh_events`/`read_chat` every few seconds), a grep for a rarer
 *    earlier line (dispatch/inject/forward) previously matched 0 because the line
 *    had already scrolled out of the tail window before the filter ran. Filtering
 *    the whole file first surfaces those matches regardless of how much unrelated
 *    spam followed them.
 *
 * Boundary-safe: lines are cut on the newline byte (0x0A) only, which never
 * appears inside a multibyte UTF-8 sequence, so decoding each complete byte
 * segment never splits a multibyte char.
 */
export declare const DEFAULT_TAIL_BYTES: number;
export declare const MAX_TAIL_BYTES: number;
export interface ReadDaemonLogTailArgs {
    /** Date of the log file to read (defaults to today). YYYY-MM-DD string or Date. */
    date?: string | Date;
    /** Max bytes of tail to return. Clamped to (0, MAX_TAIL_BYTES]. Default 64KB. */
    tailBytes?: number;
    /** Optional regex source string; only lines matching (case-insensitive) are kept. */
    grep?: string;
    /** Optional epoch-ms floor; only lines whose leading [HH:MM:SS...] / ISO ts >= this are kept. */
    sinceMs?: number;
}
export interface DaemonLogTailResult {
    success: boolean;
    error?: string;
    lines: string[];
    /**
     * No-filter mode: true when the file was larger than the byte window.
     * Filter mode: true when matching lines were dropped from the FRONT to fit
     * the byte cap (i.e. there are older matches than the ones returned).
     */
    truncated: boolean;
    logPath: string;
    platform: NodeJS.Platform;
    bytesReturned: number;
    /** True when a grep/since filter dropped at least one line. */
    filtered: boolean;
    /** The grep source actually applied (echoed back for clarity). */
    grep?: string;
    /** True when the filtered full-file scan path ran (grep/sinceMs given). */
    fullScan: boolean;
    /** Total bytes read while scanning (filter mode scans the whole file + backup). */
    scannedBytes: number;
    /** Number of lines that matched the filter across the full scan (filter mode). */
    matchedLineCount: number;
    /** Number of scanned lines dropped by the filter ("N lines excluded by filter"). */
    excludedByFilter: number;
}
/**
 * Read the daemon log tail for `date` (default today), bounded to `tailBytes`.
 *
 * - No grep/sinceMs → byte-bounded tail of the active file (legacy behaviour).
 * - grep and/or sinceMs given → FULL-FILE scan: the filter is applied across the
 *   whole file (plus the `*.1.log` size-rotation backup) BEFORE the byte cap, so
 *   matches that have scrolled out of the recent tail window (e.g. behind
 *   coordinator polling spam) are still returned. Only the last `tailBytes` worth
 *   of matching lines ship over P2P.
 *
 * Falls back to the size-rotation backup (`*.1.log`) when the primary file does
 * not exist.
 */
export declare function readDaemonLogTail(args?: ReadDaemonLogTailArgs): DaemonLogTailResult;
