/**
 * Command watches: a PTY session's output, line-buffered and filtered. A durable (restartable) watch
 * counts its matched lines in a persisted rolling fire window and carries the runaway guard, which
 * pauses it with a visible notice only after a sustained flood; a busy watch is never muted, its
 * wakes are paced by the notifier instead. Output stays in the runtime's bounded history; a record
 * holds at most one unfinished line.
 */
import { MonitorLineBuffer } from "./monitor-line-buffer.ts";
import { type MonitorFireWindow, type MonitorRecordBase, type MonitorSourceHost } from "./monitor-types.ts";
import type { TerminalRuntimeSession } from "./runtime-session.ts";
import type { MonitorDurabilityClass } from "./terminal-manifest.ts";
export interface RegisterMonitorOptions {
    readonly id: string;
    readonly command?: string | null;
    readonly persistent?: boolean;
    readonly deadlineMs?: number | null;
    /** Caller-supplied stable identity so a restore can re-bind the same "mon_" id. */
    readonly monitorId?: string;
    readonly description: string;
    readonly runtime: TerminalRuntimeSession;
    readonly filter?: RegExp;
    /** Durability class from the manifest spec; non-ephemeral records carry the fire window and runaway guard. */
    readonly durabilityClass?: MonitorDurabilityClass;
    /** Persisted fire window re-bound by a restore, so a restart cannot reset the budget. */
    readonly fireWindow?: MonitorFireWindow;
    /** Durability deadline of a durable watch; omitted for an ephemeral one. */
    readonly expiresAt?: number;
    /** Output lines are a person's words (a chat bridge); goal continuation counts them as new input. */
    readonly humanInput?: boolean;
    /** Per-monitor wake-rate override of a persistent watch; unset uses terminal.monitorWakesPerHour. */
    readonly wakesPerHour?: number;
}
/** One-minute bucket of matched lines plus the run of consecutive flood minutes before it. */
interface RunawayWindow {
    minuteStartMs: number;
    count: number;
    floodMinutes: number;
}
export interface MonitorRecord extends MonitorRecordBase {
    readonly id: string;
    readonly monitorId: string;
    readonly sessionId: string;
    readonly description: string;
    readonly startedAtMs: number;
    readonly command: string | null;
    readonly persistent: boolean;
    readonly deadlineMs: number | null;
    fireCount: number;
    lastFiredAtMs: number | null;
    readonly expiresAt: number | undefined;
    readonly runtime: TerminalRuntimeSession;
    readonly filter: RegExp | undefined;
    lineBuffer: MonitorLineBuffer;
    mutedDropped: number;
    paused: boolean;
    settled: boolean;
    fireWindow: MonitorFireWindow | undefined;
    runaway: RunawayWindow | undefined;
    readonly wakesPerHour: number | undefined;
    unsubscribeOutput: (() => void) | undefined;
    unsubscribeExit: (() => void) | undefined;
    readonly humanInput: boolean;
}
export declare class CommandMonitorSource {
    #private;
    constructor(host: MonitorSourceHost);
    get(id: string): MonitorRecord | undefined;
    values(): IterableIterator<MonitorRecord>;
    keys(): IterableIterator<string>;
    register(options: RegisterMonitorOptions): string;
    /** Re-bind a persisted fire window onto the record for a durable monitor id (a restore re-arms the budget). */
    adoptFireWindow(monitorId: string, fireWindow: MonitorFireWindow): boolean;
    dispose(): void;
}
export {};
//# sourceMappingURL=command-monitor-source.d.ts.map