UNPKG

@mastra/core

Version:
33 lines 1.93 kB
import type { NotificationDeliveryAction, NotificationDeliveryDecision, NotificationDeliveryThreadState, NotificationPriority, NotificationRecord, NotificationStatus } from './types.js'; /** * Delivery attempts allowed before a notification is marked `failed`. A failed * record is no longer due, so a deterministic delivery error (a missing model, * a rejected request context) stops being retried on every dispatch tick. */ export declare const MAX_NOTIFICATION_DELIVERY_ATTEMPTS = 5; /** * Attempt bookkeeping applied when a delivery attempt throws, spread into the * `updateNotification` call at each failure site. */ export declare function resolveDeliveryFailureUpdate(record: NotificationRecord): { deliveryAttempts: number; status?: NotificationStatus; }; export type NotificationDeliveryPolicyDecision = NotificationDeliveryAction | NotificationDeliveryDecision; export type NotificationDeliveryPolicyInput = { record: NotificationRecord; threadState: NotificationDeliveryThreadState; now: Date; }; export type NotificationDeliveryPolicyDecider = (input: NotificationDeliveryPolicyInput) => NotificationDeliveryPolicyDecision | undefined | Promise<NotificationDeliveryPolicyDecision | undefined>; export type NotificationDeliveryPolicyConfig = { default?: NotificationDeliveryPolicyDecision; priorities?: Partial<Record<NotificationPriority, NotificationDeliveryPolicyDecision>>; sources?: Record<string, NotificationDeliveryPolicyDecision>; decide?: NotificationDeliveryPolicyDecider; }; export declare function defaultNotificationDeliveryDecision(input: NotificationDeliveryPolicyInput): NotificationDeliveryDecision; export declare function resolveNotificationDeliveryDecision({ config, ...input }: NotificationDeliveryPolicyInput & { config?: NotificationDeliveryPolicyConfig; }): Promise<NotificationDeliveryDecision>; //# sourceMappingURL=delivery-policy.d.ts.map