/**
 * ComponentHealthMonitor — enforces per-component resource contracts.
 *
 * Tracks update rate and render cost per component. Components that exceed their
 * contracted budget are throttled (render gated to a minimum interval).
 * Components with sustained violations are degraded (rendered at a fixed low rate).
 *
 * The monitor does NOT render components 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.
 *
 * Surface-agnostic: a TUI panel, a web widget, or any other renderable unit
 * can register with this monitor. The TUI uses componentId values that
 * correspond to panel identifiers; other surfaces use their own naming.
 */
import type { ComponentResourceContract, ComponentHealthState } from './component-contracts.js';
/**
 * ComponentHealthMonitor — tracks component resource usage and enforces budgets.
 *
 * Usage:
 * 1. Register components with register(componentId, category).
 * 2. Before rendering: if (!monitor.canRender(componentId, now)) skip the render.
 * 3. After rendering: monitor.recordRender(componentId, durationMs, now).
 * 4. Read health via getHealth(componentId) or getAllHealth().
 */
export declare class ComponentHealthMonitor {
    private readonly _tracks;
    /**
     * Register a component with the monitor.
     *
     * If the component is already registered, this is a no-op.
     *
     * @param componentId - Unique component identifier.
     * @param category - Component category (used to select the base contract).
     * @param contractOverrides - Optional per-component contract overrides.
     */
    register(componentId: string, category: string, contractOverrides?: Partial<Omit<ComponentResourceContract, 'componentId'>>): void;
    /**
     * Deregister a component, removing all tracking state.
     */
    deregister(componentId: string): void;
    /**
     * Check whether a component is permitted to render at the given time.
     *
     * Records the render request for rate tracking regardless of the outcome.
     * If the component is not registered, renders are always permitted.
     *
     * @param componentId - Component 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(componentId: string, now?: number): boolean;
    /**
     * Record the actual render duration for a component.
     *
     * Should be called after every permitted render completes. Updates the
     * p95 render cost and may escalate the component's throttle status if the
     * render cost budget is violated.
     *
     * @param componentId - Component that rendered.
     * @param durationMs - Actual render duration in milliseconds.
     * @param now - Epoch ms at render completion (defaults to Date.now()).
     */
    recordRender(componentId: string, durationMs: number, now?: number): void;
    /**
     * Return the current health state for a component, or undefined if not registered.
     */
    getHealth(componentId: string): ComponentHealthState | undefined;
    /**
     * Return health states for all registered components.
     */
    getAllHealth(): ComponentHealthState[];
    /**
     * Return the resource contract for a registered component, or undefined.
     */
    getContract(componentId: string): ComponentResourceContract | undefined;
    /**
     * Forcibly reset a component's health state to normal.
     * Useful for tests or manual operator intervention.
     */
    resetHealth(componentId: 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 component to normal status.
     */
    private _recordClean;
    private _recover;
}
/** @deprecated Use ComponentHealthMonitor */
export { ComponentHealthMonitor as PanelHealthMonitor };
//# sourceMappingURL=component-health-monitor.d.ts.map