/** * AlertSink — Pluggable alert delivery for critical runtime events. * * Emits alerts for crash loops, restart limit exhaustion, heartbeat * timeouts, and other critical Supervisor events. Ships with a * webhook-based default implementation; custom sinks can be provided * via the `alerts.sink` config field. * * Configuration (forge.config): * * alerts: { * webhook: 'https://hooks.slack.com/...', * // Optional overrides: * headers: { Authorization: 'Bearer ...' }, * retries: 3, * retryDelayMs: 1000, * retryMaxDelayMs: 30000, * } */ export type AlertSeverity = "critical" | "warning" | "info"; export interface Alert { /** Machine-readable event type */ event: string; /** Human-readable summary */ message: string; severity: AlertSeverity; /** ISO-8601 timestamp */ timestamp: string; /** Additional structured data */ details: Record; } export interface AlertSinkConfig { /** Webhook URL for alert delivery */ webhook?: string; /** Additional headers to include in webhook requests */ headers?: Record; /** Maximum number of retry attempts for failed deliveries (default: 3) */ retries?: number; /** Base delay in ms for exponential backoff (default: 1000) */ retryDelayMs?: number; /** Maximum delay in ms for exponential backoff (default: 30000) */ retryMaxDelayMs?: number; /** Custom sink function — overrides webhook when provided */ sink?: (alert: Alert) => Promise; } /** * AlertSink delivers alerts to external systems with retry/backoff. * * Delivery is fire-and-forget from the caller's perspective — failed * alerts are logged but never block the Supervisor's main loop. */ export declare class AlertSink { private _config; private _retries; private _retryDelayMs; private _retryMaxDelayMs; private _deliveryQueue; private _stopped; constructor(config?: AlertSinkConfig); /** Whether this sink has a delivery target configured */ get isConfigured(): boolean; /** * Emit an alert. Delivery is non-blocking — errors are caught and logged. * Alerts are serialized (one at a time) to avoid overwhelming the webhook. */ emit(event: string, message: string, severity?: AlertSeverity, details?: Record): void; /** * Wait for all pending alert deliveries to complete. * Useful for graceful shutdown. */ flush(): Promise; /** Stop accepting new alerts and drain pending deliveries */ stop(): Promise; /** * Deliver a single alert with retry/backoff. */ private _deliver; /** * Send an alert via HTTP webhook POST. */ private _deliverWebhook; } //# sourceMappingURL=AlertSink.d.ts.map