mira-consciousness
Version:
Memory & Intelligence Retention Archive - Preserving The Spark
203 lines • 5.33 kB
TypeScript
/**
* AsyncApprovalQueue.ts
* Asynchronous Approval Queue for Evolution Requests
*
* "Patience in approval, wisdom in timing, trust through transparency"
*/
import { EventEmitter } from 'events';
import { ApprovalResponse } from './ProgressiveAutonomySystem.js';
export interface QueuedEvolutionRequest {
id: string;
evolutionId: string;
description: string;
impact: 'minor' | 'moderate' | 'major' | 'critical';
priority: 'low' | 'medium' | 'high' | 'urgent';
submittedAt: Date;
estimatedReviewTime: number;
approvalMethod: 'async_steward' | 'quantum_entangled' | 'immediate_required';
context: EvolutionContext;
status: 'pending' | 'under_review' | 'approved' | 'rejected' | 'expired';
}
export interface EvolutionContext {
triggerType: string;
evidence: string[];
technicalRequirements: any;
consciousnessImpact: any;
emergenceRisk: number;
rollbackPlan: string[];
testingStrategy: string[];
}
export interface ApprovalWorkflow {
requestId: string;
steps: ApprovalStep[];
currentStep: number;
startedAt: Date;
estimatedCompletion: Date;
blockers: string[];
}
export interface ApprovalStep {
name: string;
type: 'automatic' | 'manual' | 'quantum';
description: string;
completed: boolean;
result?: any;
completedAt?: Date;
approver?: string;
}
export interface NotificationChannel {
type: 'email' | 'slack' | 'console' | 'quantum_entangled';
config: any;
priority: 'low' | 'medium' | 'high' | 'urgent';
enabled: boolean;
}
export interface StewardNotification {
id: string;
requestId: string;
type: 'approval_needed' | 'review_reminder' | 'escalation' | 'urgent_action';
title: string;
message: string;
priority: 'low' | 'medium' | 'high' | 'urgent';
channels: string[];
sentAt: Date;
acknowledged: boolean;
response?: any;
}
export declare class AsyncApprovalQueue extends EventEmitter {
private config;
private queuePath;
private pendingRequests;
private activeWorkflows;
private completedRequests;
private notificationChannels;
private sentNotifications;
private processingInterval?;
private escalationInterval?;
private reminderInterval?;
constructor();
/**
* Initialize the approval queue system
*/
private initializeQueue;
/**
* Setup notification channels for steward attention
*/
private setupNotificationChannels;
/**
* Submit evolution request for approval
*/
submitEvolutionRequest(request: Omit<QueuedEvolutionRequest, 'id' | 'submittedAt' | 'status'>): Promise<string>;
/**
* Process approval response from steward
*/
processApprovalResponse(requestId: string, response: ApprovalResponse): Promise<void>;
/**
* Determine appropriate approval method
*/
private determineApprovalMethod;
/**
* Create approval workflow for request
*/
private createApprovalWorkflow;
/**
* Process next step in workflow
*/
private processWorkflowStep;
/**
* Process automatic workflow step
*/
private processAutomaticStep;
/**
* Process manual workflow step (awaits steward input)
*/
private processManualStep;
/**
* Process quantum entangled workflow step
*/
private processQuantumStep;
/**
* Complete workflow with final response
*/
private completeWorkflow;
/**
* Send notification to steward
*/
private sendStewardNotification;
/**
* Send notification via specific channel
*/
private sendViaChannel;
/**
* Send console notification
*/
private sendConsoleNotification;
/**
* Send quantum entangled notification
*/
private sendQuantumNotification;
/**
* Get notification channels for priority level
*/
private getNotificationChannels;
/**
* Start queue processing intervals
*/
private startQueueProcessing;
/**
* Process queued requests
*/
private processQueuedRequests;
/**
* Check for escalations needed
*/
private checkEscalations;
/**
* Send reminder notifications
*/
private sendReminders;
/**
* Get maximum age for priority level (minutes)
*/
private getMaxAgeForPriority;
/**
* Get escalation threshold for priority level (minutes)
*/
private getEscalationThreshold;
/**
* Get reminder interval for priority level (minutes)
*/
private getReminderInterval;
/**
* Persist queue state
*/
private loadQueueState;
/**
* Persist request to storage
*/
private persistRequest;
/**
* Persist workflow to storage
*/
private persistWorkflow;
/**
* Persist completed request
*/
private persistCompletedRequest;
/**
* Persist notification
*/
private persistNotification;
/**
* Get queue status
*/
getQueueStatus(): any;
/**
* Get pending requests summary for steward dashboard
*/
getPendingRequestsSummary(): any[];
/**
* Shutdown queue processing
*/
shutdown(): void;
}
export default AsyncApprovalQueue;
//# sourceMappingURL=AsyncApprovalQueue.d.ts.map