/**
 * PanelHealthMonitor — enforces per-panel resource contracts.
 *
 * Tracks update rate and render cost per panel. Panels that exceed their
 * contracted budget are throttled (render gated to a minimum interval).
 * Panels with sustained violations are degraded (rendered at a fixed low rate).
 *
 * The monitor does NOT render panels itself — callers ask canRender() before
 * rendering and report the actual render cost via recordRender().
 *
 * This keeps the monitor policy-focused and the rendering path ignorant of
 * throttling policy details.
 */
import type { PanelResourceContract, PanelHealthState } from './panel-contracts.js';
/**
 * PanelHealthMonitor — tracks panel resource usage and enforces budgets.
 *
 * Usage:
 * 1. Register panels with register(panelId, category).
 * 2. Before rendering: if (!monitor.canRender(panelId, now)) skip the render.
 * 3. After rendering: monitor.recordRender(panelId, durationMs, now).
 * 4. Read health via getHealth(panelId) or getAllHealth().
 */
export declare class PanelHealthMonitor {
    private readonly _tracks;
    /**
     * Register a panel with the monitor.
     *
     * If the panel is already registered, this is a no-op.
     *
     * @param panelId - Unique panel identifier.
     * @param category - Panel category (used to select the base contract).
     * @param contractOverrides - Optional per-panel contract overrides.
     */
    register(panelId: string, category: string, contractOverrides?: Partial<Omit<PanelResourceContract, 'panelId'>>): void;
    /**
     * Deregister a panel, removing all tracking state.
     */
    deregister(panelId: string): void;
    /**
     * Check whether a panel is permitted to render at the given time.
     *
     * Records the render request for rate tracking regardless of the outcome.
     * If the panel is not registered, renders are always permitted.
     *
     * @param panelId - Panel to check.
     * @param now - Current epoch ms (defaults to Date.now()).
     * @returns true if the render is permitted; false if it should be skipped.
     */
    canRender(panelId: string, now?: number): boolean;
    /**
     * Record the actual render duration for a panel.
     *
     * Should be called after every permitted render completes. Updates the
     * p95 render cost and may escalate the panel's throttle status if the
     * render cost budget is violated.
     *
     * @param panelId - Panel that rendered.
     * @param durationMs - Actual render duration in milliseconds.
     * @param now - Epoch ms at render completion (defaults to Date.now()).
     */
    recordRender(panelId: string, durationMs: number, now?: number): void;
    /**
     * Return the current health state for a panel, or undefined if not registered.
     */
    getHealth(panelId: string): PanelHealthState | undefined;
    /**
     * Return health states for all registered panels.
     */
    getAllHealth(): PanelHealthState[];
    /**
     * Return the resource contract for a registered panel, or undefined.
     */
    getContract(panelId: string): PanelResourceContract | undefined;
    /**
     * Forcibly reset a panel's health state to normal.
     * Useful for tests or manual operator intervention.
     */
    resetHealth(panelId: string): void;
    private _rotateWindow;
    private _applyViolation;
    /**
     * Dual-path recovery: `_recordClean` handles render-cost-based recovery
     * (triggered from `recordRender` after a cheap render), while `_rotateWindow`
     * handles rate-based recovery (triggered at window boundaries). Both paths
     * call `_recover` once the clean-window threshold is met, so either signal
     * alone is sufficient to restore a panel to normal status.
     */
    private _recordClean;
    private _recover;
}
//# sourceMappingURL=panel-health-monitor.d.ts.map