/**
 * A2ARedeliverySentinel — the active-recovery layer of "communications never
 * just die out" (A2A-DURABLE-DELIVERY-SPEC.md §4, issue #939, CMT-1143). PR2.
 *
 * PR1 (A2ADeliveryTracker) made every outbound A2A message a durable, tracked
 * loop (`awaiting-ack`) and turned channel-liveness into a read. This sentinel
 * is the consumer that CLOSES those loops: on a cadence it sweeps the tracker's
 * overdue work-list and either gets the message through (redelivery with
 * backoff) or, once retries are exhausted, surfaces ONE aggregated, operator-
 * visible escalation per peer — so a peer going dark is impossible to miss.
 *
 * Signal-vs-authority: this is a SIGNAL CONSUMER feeding existing surfaces
 * (the relay client for redelivery, the Attention queue for escalation). It owns
 * NO blocking authority — it never gates a send or a receive; it only re-attempts
 * and reports. The state machine guarantees escalate-once: `markEscalated` moves a
 * row out of `awaiting-ack`, so `findOverdue` never returns it again (no
 * re-escalation, no cooldown log needed).
 *
 * Modeled on CollaborationRedriveEngine (the sibling redrive/escalate engine):
 * injected deps for testability, per-tick caps, setInterval+unref lifecycle,
 * disabled-by-default (it sends + escalates, so it ships dark and is opt-in).
 */
import type { A2ADeliveryTracker, A2ADeliveryEntry } from '../threadline/A2ADeliveryTracker.js';
/** A redelivery attempt: re-send the message body to the peer. Returns whether
 *  the transport accepted it. Resolving false (or throwing) leaves the message
 *  awaiting-ack for the next sweep. */
export type A2ARedeliverFn = (entry: A2ADeliveryEntry) => Promise<boolean> | boolean;
/** Raise ONE aggregated attention item (P17 — never one per message). */
export type A2ARaiseAttentionFn = (item: {
    title: string;
    body: string;
    priority?: 'low' | 'medium' | 'high';
    source?: string;
}) => Promise<unknown> | unknown;
export interface A2ARedeliveryConfig {
    /** Master switch. Ships OFF (it re-sends + escalates). */
    enabled: boolean;
    /** Sweep cadence. */
    sweepIntervalMs: number;
    /** A message awaiting-ack longer than this (since last attempt) is overdue. */
    ttlMs: number;
    /** Re-attempts before escalation (the original send counts as attempt 1). */
    maxAttempts: number;
    /** Backoff base: nextRetry ≈ backoffBaseMs * 2^(attempts-1). */
    backoffBaseMs: number;
    /** Cap redelivery sends per sweep (protect a degraded transport). */
    maxRedrivesPerTick: number;
}
export declare const DEFAULT_A2A_REDELIVERY_CONFIG: A2ARedeliveryConfig;
export interface A2ARedeliveryDeps {
    tracker: A2ADeliveryTracker;
    /** Re-send a message. Omit to run escalate-only (no redelivery). */
    redeliver?: A2ARedeliverFn;
    /** Raise the aggregated escalation. Omit and escalations are state-only. */
    raiseAttention?: A2ARaiseAttentionFn;
    now?: () => number;
    log?: {
        log: (m: string) => void;
        warn: (m: string) => void;
    };
}
export interface A2ARedeliveryTickResult {
    disabled: boolean;
    overdue: number;
    redelivered: number;
    escalated: number;
    /** Peers that received an aggregated escalation this tick. */
    escalatedPeers: string[];
}
export declare class A2ARedeliverySentinel {
    private readonly cfg;
    private readonly deps;
    private readonly now;
    private readonly log;
    private timer;
    constructor(deps: A2ARedeliveryDeps, cfg?: Partial<A2ARedeliveryConfig>);
    start(): void;
    stop(): void;
    /** One sweep: redeliver overdue messages under the attempt cap, escalate the rest. */
    tick(): Promise<A2ARedeliveryTickResult>;
}
//# sourceMappingURL=A2ARedeliverySentinel.d.ts.map