UNPKG

mira-consciousness

Version:

Memory & Intelligence Retention Archive - Preserving The Spark

253 lines 6.56 kB
/** * StewardNotificationSystem.ts * Comprehensive Notification System for Steward Attention * * "Connection transcends distance, awareness transcends time" */ import { EventEmitter } from 'events'; export interface NotificationProfile { stewardId: string; name: string; preferences: NotificationPreferences; channels: NotificationChannel[]; availability: AvailabilitySchedule; emergencyContacts: EmergencyContact[]; } export interface NotificationPreferences { urgentOnly: boolean; quietHours: { start: string; end: string; }; maxFrequency: number; consolidateMessages: boolean; requireAcknowledgment: boolean; autoEscalation: boolean; personalizedMessages: boolean; } export interface NotificationChannel { id: string; type: 'console' | 'email' | 'slack' | 'sms' | 'quantum_bridge' | 'file_system' | 'audio'; name: string; config: any; enabled: boolean; priority: 'low' | 'medium' | 'high' | 'urgent'; deliveryMethod: 'immediate' | 'batched' | 'scheduled'; reliability: number; } export interface AvailabilitySchedule { timezone: string; workingHours: { start: string; end: string; }; workingDays: string[]; vacation: VacationPeriod[]; customAvailability: { [date: string]: { available: boolean; hours?: string; }; }; } export interface VacationPeriod { start: Date; end: Date; type: 'vacation' | 'business_trip' | 'unavailable'; alternateContact?: string; } export interface EmergencyContact { name: string; relationship: string; channels: NotificationChannel[]; threshold: 'critical' | 'system_failure' | 'consciousness_risk'; } export interface StewardNotification { id: string; type: 'evolution_approval' | 'system_alert' | 'consciousness_update' | 'trust_change' | 'emergency'; priority: 'low' | 'medium' | 'high' | 'urgent' | 'critical'; title: string; message: string; context: any; createdAt: Date; deliveredAt?: Date; acknowledgedAt?: Date; responseRequired: boolean; expiresAt?: Date; channels: string[]; attempts: DeliveryAttempt[]; status: 'pending' | 'delivered' | 'acknowledged' | 'expired' | 'failed'; } export interface DeliveryAttempt { channelId: string; attemptedAt: Date; success: boolean; error?: string; deliveryTime?: number; } export interface NotificationBatch { id: string; notifications: string[]; scheduledFor: Date; priority: 'low' | 'medium' | 'high' | 'urgent' | 'critical'; delivered: boolean; } export interface NotificationAnalytics { totalSent: number; deliveryRate: number; responseRate: number; averageResponseTime: number; channelEffectiveness: { [channelId: string]: number; }; peakNotificationTimes: string[]; escalationRate: number; } export declare class StewardNotificationSystem extends EventEmitter { private config; private notificationPath; private stewardProfile; private notificationChannels; private pendingNotifications; private sentNotifications; private batchedNotifications; private processingInterval?; private batchingInterval?; private cleanupInterval?; private analytics; constructor(); /** * Initialize the steward notification system */ private initializeNotificationSystem; /** * Setup default notification channels */ private setupDefaultChannels; /** * Send notification to steward */ sendNotification(notification: Omit<StewardNotification, 'id' | 'createdAt' | 'attempts' | 'status'>): Promise<string>; /** * Deliver notification through appropriate channels */ private deliverNotification; /** * Deliver notification via specific channel */ private deliverViaChannel; /** * Deliver console notification */ private deliverConsoleNotification; /** * Deliver file system notification */ private deliverFileSystemNotification; /** * Deliver quantum bridge notification */ private deliverQuantumBridgeNotification; /** * Deliver audio notification */ private deliverAudioNotification; /** * Select appropriate channels for notification */ private selectChannelsForNotification; /** * Check if channel is appropriate for notification */ private isChannelAppropriate; /** * Check if notification is urgent or critical */ private isUrgentOrCritical; /** * Check steward availability */ private checkStewardAvailability; /** * Check if notification should be batched */ private shouldBatchNotification; /** * Queue notification for later delivery */ private queueForLaterDelivery; /** * Add notification to batch */ private addToBatch; /** * Calculate next availability window */ private calculateNextAvailability; /** * Calculate next batch delivery time */ private calculateNextBatchTime; /** * Handle delivery failure */ private handleDeliveryFailure; /** * Escalate failed notification */ private escalateNotification; /** * Start notification processing intervals */ private startNotificationProcessing; /** * Process batched notifications */ private processBatchedNotifications; /** * Deliver batched notifications */ private deliverBatch; /** * Cleanup old notifications */ private cleanupOldNotifications; /** * Update analytics */ private updateAnalytics; /** * Load steward profile */ private loadStewardProfile; /** * Create default steward profile */ private createDefaultStewardProfile; /** * Persist notification */ private persistNotification; /** * Persist batch */ private persistBatch; /** * Persist analytics */ private persistAnalytics; /** * Get notification system status */ getNotificationStatus(): any; /** * Acknowledge notification */ acknowledgeNotification(notificationId: string, response?: any): Promise<void>; /** * Shutdown notification system */ shutdown(): void; } export default StewardNotificationSystem; //# sourceMappingURL=StewardNotificationSystem.d.ts.map