/**
 * Team-Health-Watchdog (THW) — Service Shell (Layer 4)
 *
 * Wires the pure detector + alert router to live data sources, runs the
 * 60s sweep loop, exposes API for the orchestrator skill / health endpoint.
 *
 * Architecture (§A.5): keep sweep+dedup+rate-limit+heartbeat strictly
 * separable from the detector. v0.5 will extract these protected members
 * into a `WatchdogBase`.
 *
 * Layer-4 invariant (§A.1): READS lower-layer state, EMITS alerts.
 * NEVER mutates `agent.status`, claims, or work items.
 *
 * @module services/team-health/team-health-watchdog.service
 */
import type { AlertDecision, TeamHealthConfig, TeamHealthDetection, TeamHealthSnapshot, TeamHealthSweepResult } from './team-health-types.js';
import { TeamHealthAlertRouter } from './team-health-alert-router.js';
/**
 * THW data provider — connects the detector to live state. Tests pass
 * a fixture-driven provider; production wiring lives outside this module.
 */
export interface TeamHealthDataProvider {
    collectSnapshot(now: Date): Promise<TeamHealthSnapshot>;
}
/**
 * Delivers an alert decision out to humans. Resolves successfully even
 * on transport error; the watchdog logs but does not retry — next sweep
 * re-emits if the verdict still holds (idempotent dedup).
 */
export interface AlertSink {
    deliver(decision: AlertDecision): Promise<void>;
}
export interface WatchdogLogger {
    info(msg: string, meta?: Record<string, unknown>): void;
    warn(msg: string, meta?: Record<string, unknown>): void;
    error(msg: string, meta?: Record<string, unknown>): void;
}
export interface TeamHealthWatchdogOptions {
    config: TeamHealthConfig;
    dataProvider: TeamHealthDataProvider;
    alertSink: AlertSink;
    bootedAt?: Date;
    logger?: WatchdogLogger;
    clock?: () => Date;
}
/**
 * The watchdog service. Owns the sweep loop and exposes the public API.
 */
export declare class TeamHealthWatchdogService {
    protected sweepIntervalMs: number;
    protected bootedAt: Date;
    protected router: TeamHealthAlertRouter;
    private config;
    private dataProvider;
    private alertSink;
    private logger;
    private clock;
    private timer;
    private lastSweep;
    private isRunning;
    constructor(opts: TeamHealthWatchdogOptions);
    /**
     * Start the periodic sweep loop. Idempotent. Per §11.3 self-instrumentation,
     * we run `runOnce` immediately on start so /api/health has data from boot.
     */
    start(): void;
    /**
     * Stop the periodic sweep loop. After stop(), `last_sweep_age_ms` grows;
     * /api/health surfaces this so a stuck watchdog itself shows as 'degraded'
     * (§E.8 watchdog-watchdog).
     */
    stop(): void;
    /**
     * Run one sweep on demand. Catches own errors and returns a degraded
     * sweep result rather than throwing.
     */
    runOnce(): Promise<TeamHealthSweepResult>;
    /**
     * Get the most recent sweep result; null until `start()`/`runOnce()` runs.
     */
    getLastSweep(): TeamHealthSweepResult | null;
    /**
     * Milliseconds since the last sweep. -1 if no sweep has ever completed.
     */
    getLastSweepAgeMs(): number;
    /**
     * Self-health probe — the watchdog-watchdog (§E.8). True when the
     * sweep loop appears stuck (age > 3× sweep interval).
     */
    isDegraded(): boolean;
    /**
     * Per-team verdicts from the most recent sweep. Backs the
     * orchestrator `team-health-scan` skill (§6.5).
     */
    getCurrentVerdicts(teamId?: string): TeamHealthDetection[];
    /**
     * Apply an updated config at runtime (e.g., post-edit reload).
     */
    reconfigure(config: TeamHealthConfig): void;
    /**
     * Apply a manual silence to a team (Slack 🔇 react handler).
     */
    silenceTeam(teamId: string, durationMs: number): void;
    /**
     * Read the running flag — used by /api/health.
     */
    isActive(): boolean;
}
export declare function setTeamHealthWatchdogSingleton(svc: TeamHealthWatchdogService): void;
export declare function getTeamHealthWatchdogSingleton(): TeamHealthWatchdogService | null;
//# sourceMappingURL=team-health-watchdog.service.d.ts.map