import type { AutomationDeliveryManager } from './delivery-manager.js'; import type { AutomationDeliveryTarget } from './delivery.js'; import type { AutomationJob } from './jobs.js'; import type { AutomationRun } from './runs.js'; interface AutomationFailureFollowUpContext { readonly jobs: Map; readonly retryTimers: Map>; readonly deliveryManager: AutomationDeliveryManager | null; readonly activeRunCount: () => number; readonly maxConcurrentRuns: () => number; readonly executeJob: (job: AutomationJob, trigger: 'scheduled', dueRun: boolean, attempt?: number) => Promise; readonly saveJobs: () => Promise; readonly scheduleJob: (job: AutomationJob) => void; } interface AutomationRunDeliveryContext { readonly runs: Map; readonly deliveryInFlight: Set; readonly deliveryManager: AutomationDeliveryManager | null; readonly syncRunToRuntime: (run: AutomationRun, source: string) => void; readonly saveRuns: () => Promise; } export declare function scheduleAutomationFailureFollowUp(context: AutomationFailureFollowUpContext, maybeDeliverFailureNotice: (job: AutomationJob, run: AutomationRun) => void, job: AutomationJob, run: AutomationRun, deliverNotice?: boolean): void; /** * Resolve where a failure (or missed-run) notice for `job` should go. * * Priority: * 1. The per-job failure override, its `notifyRouteId` / `deadLetterRouteId` * surface routes, when either is set. An explicit failure channel wins. * 2. Otherwise the job's OWN normal delivery targets (`delivery.targets`, or * `delivery.replyToRouteId`), with `delivery.fallbackTargets` as the * fallback, the same targets its ordinary run deliveries use. A job whose * delivery is turned off (`mode === 'none'`) contributes no default here; * only its explicit failure override can reach anyone. * * Returns `{ primary, fallback }`. When both are empty the job has no reachable * target at all and the caller records the honest gap. */ export declare function resolveAutomationFailureNoticeTargets(job: AutomationJob): { readonly primary: readonly AutomationDeliveryTarget[]; readonly fallback: readonly AutomationDeliveryTarget[]; }; /** * Deliver a failure (or missed-run) notice for a job's run. * * The notice flows to the job's own delivery targets by default so a failed or * slept-through overnight job still reaches its human, not only to a separately * configured failure route. `onDeliveryGap` is invoked (once, at the caller's * discretion) when the job has no reachable target at all, so the gap is logged * honestly instead of failing silently. */ export declare function maybeDeliverAutomationFailureNotice(deliveryManager: AutomationDeliveryManager | null, job: AutomationJob, run: AutomationRun, onDeliveryGap?: (job: AutomationJob, run: AutomationRun) => void): void; export declare function maybeDeliverAutomationRun(context: AutomationRunDeliveryContext, job: AutomationJob, run: AutomationRun): void; export {}; //# sourceMappingURL=manager-runtime-delivery.d.ts.map