/**
 * @fileoverview Connection heartbeat monitor for MCP transports.
 * Periodically pings the connected client to verify liveness and emits
 * an OTel failure counter for alerting on unresponsive connections.
 *
 * The MCP spec recommends periodic pings to detect connection health.
 * This module implements server-initiated pings with configurable interval
 * and miss threshold, triggering cleanup when a client becomes unresponsive.
 * @module src/mcp-server/transports/heartbeat
 */
import { type RequestContext } from '../../utils/internal/requestContext.js';
/** Configuration for a {@link HeartbeatMonitor} instance. */
export interface HeartbeatOptions {
    /** Milliseconds between ping attempts. `0` disables heartbeat. */
    intervalMs: number;
    /** Consecutive ping failures before declaring the connection dead. */
    missThreshold: number;
    /**
     * Called when consecutive failures reach {@link missThreshold}.
     * Typically triggers graceful shutdown of the transport.
     */
    onDead: () => void;
    /**
     * Sends a ping to the connected client. Must reject/throw on failure
     * or timeout — the monitor counts consecutive rejections.
     */
    sendPing: () => Promise<unknown>;
    /** Transport type label for OTel metric attributes (e.g. `'stdio'`). */
    transport: string;
}
/** Eagerly create metric series so they exist from the first export cycle. */
export declare function initHeartbeatMetrics(): void;
/**
 * Periodically pings the connected MCP client and tracks liveness.
 *
 * Uses a recursive `setTimeout` pattern (not `setInterval`) so pings
 * never overlap — each cycle waits for the previous ping to resolve
 * before scheduling the next one.
 *
 * On {@link HeartbeatOptions.missThreshold} consecutive failures the
 * monitor calls {@link HeartbeatOptions.onDead} and stops itself.
 */
export declare class HeartbeatMonitor {
    private timer;
    private consecutiveFailures;
    private stopped;
    private readonly opts;
    private readonly context;
    private readonly attrs;
    constructor(opts: HeartbeatOptions, parentContext?: RequestContext);
    /** Begin the ping cycle. No-op if `intervalMs <= 0`. */
    start(): void;
    /** Stop the ping cycle. */
    stop(): void;
    private scheduleNext;
    private tick;
}
//# sourceMappingURL=heartbeat.d.ts.map