import type { ProactivitySettings } from '@xopcai/gateway-contract'; import type { Config } from '../../config/schema.js'; export declare const INFERRED_PROACTIVE_MESSAGES_NAMESPACE = "proactivity-messages"; export type ProactiveDeliveryAuthority = 'user_explicit' | 'inferred'; export type ProactiveDeliveryBlockReason = 'stopped' | 'personal_unavailable' | 'conversation_busy' | 'mode_off' | 'quiet_hours' | 'follow_up_mode_blocks_inferred' | 'daily_quota_exhausted'; export type ProactiveDeliveryGateResult = { allowed: true; settings: ProactivitySettings; } | { allowed: false; reason: ProactiveDeliveryBlockReason; settings: ProactivitySettings; }; export interface ProactiveDeliveryGateParams { ownerId: string; conversationId: string; authority: ProactiveDeliveryAuthority; config: Config; isAvailable: (conversationId: string) => boolean; now: number; stopped?: boolean; } export declare function isProactiveAccessible(config: Config, conversationId: string): boolean; export declare function isAssistantConversationDeliverable(config: Config, conversationId: string, isAvailable: (conversationId: string) => boolean, stopped?: boolean): boolean; export declare function getUsedInferredDailyMessages(ownerId: string, now: number, settings?: ProactivitySettings): number; export declare function getRemainingInferredDailyMessages(ownerId: string, now: number, settings?: ProactivitySettings): number; /** * Unified proactive delivery gate shared by ProactivityService and ProactiveHubService. * Explicit delegations ('user_explicit' / 'one_shot') pass 'follow_up' mode and do not consume * inferred daily quota; all inferred sources ('inferred', including Hub Tier-S chat escalations) * are blocked in 'follow_up' mode and share a single daily quota counter. */ export declare class ProactiveDeliveryGovernor { check(params: ProactiveDeliveryGateParams): ProactiveDeliveryGateResult; /** * Re-validates delivery eligibility and atomically reserves 1 daily inferred message slot * when authority === 'inferred'. Must be called inside the publish SQLite write transaction. */ tryReserveSlot(params: ProactiveDeliveryGateParams): ProactiveDeliveryGateResult; } export declare const proactiveDeliveryGovernor: ProactiveDeliveryGovernor;