import type { WebhookEvent } from "./types.js"; export interface WebhookPayload { event: WebhookEvent; timestamp: string; /** v2.1 Phase 4e: uuidv4 assigned at initial fire; stable across retries (payload is stored verbatim). Recipients dedupe on this. */ delivery_id: string; /** * v2.1 Phase 4e: stable per-underlying-event identifier. Derived as * `:::` where resource_id is the most * specific ID present (message_id / task_id / channel_name / timestamp). * Recipients dedupe AND correlate related retries on this. */ idempotency_key: string; from_agent?: string; to_agent?: string; content?: string; task?: { id: string; title: string; status: string; priority: string; result?: string | null; }; message_id?: string; task_id?: string; channel_name?: string; previous_agent?: string; reason?: string | null; required_capabilities?: string[] | null; chosen_agent?: string; queue_depth?: number; tasks_reassigned_count?: number; routed?: boolean; assigned_to?: string | null; candidate_count?: number; auto_routed?: boolean; auto_assigned_from_queue?: boolean; cancelled_by?: string; triggered_by?: string; capability?: string; routed_to?: string[]; message_count?: number; } /** * v2.1 Phase 4e: derive a stable idempotency key from the event + participants + * most-specific resource ID in the payload data. Recipients dedupe on this. * Exported for tests. */ export declare function deriveIdempotencyKey(event: WebhookEvent, fromAgent: string, toAgent: string, data: Partial): string; /** * Fire webhooks matching the event. Fire-and-forget with timeout. * Never throws — errors are logged to webhook_delivery_log. */ export declare function fireWebhooks(event: WebhookEvent, fromAgent: string, toAgent: string, data: Partial): void; /** * v2.0 final: process any due webhook retries. Piggybacked on tool calls * that fire webhooks (send_message, broadcast, post_task, post_task_auto, * update_task, register_webhook). Bounded — each piggyback processes up to * RELAY_WEBHOOK_RETRY_BATCH_SIZE (default 10) jobs. * * Fire-and-forget. Any error inside is swallowed (logged only) — the main * tool call must not fail because a retry failed. */ export declare function processDueWebhookRetries(): void; //# sourceMappingURL=webhooks.d.ts.map