/**
 * Webhook Lifecycle Manager.
 *
 * Stateless utility that executes declarative lifecycle HTTP requests to
 * list, register, and unregister webhooks with external services.
 *
 * Used by webhook ingestors with a `lifecycle` config block to auto-register
 * webhooks on start, clean up stale registrations (e.g., after tunnel URL changes),
 * and unregister on permanent shutdown or instance deletion.
 *
 * All HTTP requests use native `fetch()` directly (not proxy routes) since
 * secrets are already resolved and lifecycle URLs may not match the
 * connection's `allowedEndpoints` patterns.
 */
import type { WebhookLifecycleConfig, WebhookRegistrationState } from './lifecycle-types.js';
export declare class WebhookLifecycleManager {
    private readonly config;
    private readonly secrets;
    constructor(config: WebhookLifecycleConfig, secrets: Record<string, string>);
    /**
     * Ensure a webhook is registered with the external service (idempotent).
     *
     * Flow:
     * 1. If `list` config exists → fetch existing webhooks, find one matching
     *    callbackUrl (+ modelId if provided) → reuse if found
     * 2. Find stale webhooks (matching modelId but wrong callbackUrl) → unregister each
     * 3. If no match → call `register` to create a new webhook
     *
     * Graceful degradation: if `list` fails, attempts direct `register`.
     * All errors are caught and returned in the state object.
     */
    ensureRegistered(callbackUrl: string, modelId?: string): Promise<WebhookRegistrationState>;
    /**
     * Unregister a webhook by ID.
     * Replaces `${_webhookId}` in the unregister URL with the given ID.
     * Errors are logged but never thrown.
     */
    unregister(webhookId: string): Promise<void>;
    /** Fetch the list of existing webhooks from the external service. */
    private listWebhooks;
    /** Register a new webhook with the external service. */
    private register;
    /** Resolve headers with placeholder substitution. */
    private resolveHeaders;
}
//# sourceMappingURL=webhook-lifecycle-manager.d.ts.map