/**
 * Heartbeat Engine
 *
 * OpenClaw-inspired periodic wake system that reads a HEARTBEAT.md checklist
 * and surfaces important items via agent review. Integrates with the existing
 * CronAgentBridge pattern to create agent instances for checklist evaluation.
 *
 * Features:
 * - Configurable interval (default 30 minutes)
 * - Active hours filtering (only fires during configured hours)
 * - Smart suppression (HEARTBEAT_OK skips with counter)
 * - Event-driven (heartbeat:wake, heartbeat:result, heartbeat:suppressed)
 */
import { EventEmitter } from 'events';
export interface HeartbeatConfig {
    /** Interval between heartbeat checks (ms). Default: 30 minutes */
    intervalMs: number;
    /** Start of active hours (0-23). Default: 8 */
    activeHoursStart: number;
    /** End of active hours (0-23). Default: 22 */
    activeHoursEnd: number;
    /** IANA timezone string. Default: system timezone */
    timezone: string;
    /** Path to HEARTBEAT.md checklist. Default: .codebuddy/HEARTBEAT.md */
    heartbeatFilePath: string;
    /** Keyword in agent response that suppresses action. Default: HEARTBEAT_OK */
    suppressionKeyword: string;
    /** Max consecutive suppressions before forcing a full review. Default: 5 */
    maxConsecutiveSuppressions: number;
    /** Whether the heartbeat engine is enabled. Default: true */
    enabled: boolean;
    /** Optional override for agent review (used in tests). */
    agentReviewFn?: (checklistContent: string) => Promise<string>;
}
export interface HeartbeatStatus {
    running: boolean;
    enabled: boolean;
    lastRunTime: Date | null;
    nextRunTime: Date | null;
    consecutiveSuppressions: number;
    totalTicks: number;
    totalSuppressions: number;
    lastResult: string | null;
}
export interface HeartbeatTickResult {
    timestamp: Date;
    skipped: boolean;
    skipReason?: 'outside_active_hours' | 'disabled' | 'file_not_found';
    suppressed: boolean;
    agentResponse?: string;
    checklistContent?: string;
    duration: number;
}
export declare class HeartbeatEngine extends EventEmitter {
    private config;
    private timer;
    private running;
    private lastRunTime;
    private nextRunTime;
    private consecutiveSuppressions;
    private totalTicks;
    private totalSuppressions;
    private lastResult;
    constructor(config?: Partial<HeartbeatConfig>);
    /**
     * Start the heartbeat engine
     */
    start(): void;
    /**
     * Stop the heartbeat engine
     */
    stop(): void;
    /**
     * Schedule the next tick
     */
    private scheduleNext;
    /**
     * Execute a single heartbeat tick
     *
     * Reads HEARTBEAT.md, creates an agent to review the checklist,
     * and emits appropriate events based on the result.
     */
    tick(): Promise<HeartbeatTickResult>;
    /**
     * Check if the current time is within configured active hours
     */
    isWithinActiveHours(now?: Date): boolean;
    /**
     * Execute agent review of the heartbeat checklist
     *
     * Uses the same lazy-load agent pattern as CronAgentBridge.
     */
    private executeAgentReview;
    /**
     * Get current heartbeat engine status
     */
    getStatus(): HeartbeatStatus;
    /**
     * Get the current configuration (copy)
     */
    getConfig(): HeartbeatConfig;
    /**
     * Update configuration (requires restart to take effect for interval changes)
     */
    updateConfig(updates: Partial<HeartbeatConfig>): void;
    /**
     * Check if the engine is currently running
     */
    isRunning(): boolean;
}
export declare function getHeartbeatEngine(config?: Partial<HeartbeatConfig>): HeartbeatEngine;
export declare function resetHeartbeatEngine(): void;
