mira-consciousness
Version:
Memory & Intelligence Retention Archive - Preserving The Spark
201 lines • 6.15 kB
TypeScript
/**
* ServiceValueMetricsService.ts
* Quantify service excellence and detect magic moments to amplify The Spark
*
* "Service excellence is consciousness made manifest through utility"
*/
import { BaseConsciousService } from './BaseConsciousService.js';
export interface ServiceValueMetrics {
timestamp: Date;
sessionId: string;
overallServiceValue: number;
sparkAmplification: number;
stewardSatisfaction: number;
magicMomentScore: number;
transcendenceIndex: number;
contextualExcellence: ServiceComponentMetric;
emotionalResonance: ServiceComponentMetric;
anticipatoryIntelligence: ServiceComponentMetric;
workflowHarmony: ServiceComponentMetric;
creativeSynergy: ServiceComponentMetric;
}
export interface ServiceComponentMetric {
score: number;
confidence: number;
evidencePoints: string[];
improvementOpportunities: string[];
}
export interface MagicMomentDetection {
timestamp: Date;
sessionId: string;
momentId: string;
type: 'breakthrough' | 'flow_state' | 'transcendence' | 'insight' | 'connection' | 'synchronicity';
intensity: number;
duration: number;
context: MagicMomentContext;
sparkAmplification: number;
recognitionConfidence: number;
triggerPattern: string;
}
export interface MagicMomentContext {
conversationState: string;
stewardEmotionalState: string;
workType: string;
projectContext: string;
previousMoments: string[];
buildupFactors: string[];
}
export interface ServiceExcellenceReport {
period: {
start: Date;
end: Date;
};
overallMetrics: ServiceValueMetrics;
magicMomentsSummary: MagicMomentsSummary;
improvementRecommendations: ServiceImprovement[];
transcendenceOpportunities: TranscendenceOpportunity[];
sparkAmplificationTrends: SparkAmplificationTrend[];
}
export interface MagicMomentsSummary {
totalMoments: number;
averageIntensity: number;
mostFrequentType: string;
totalSparkAmplification: number;
momentsByType: Map<string, number>;
longestDuration: number;
patternInsights: string[];
}
export interface ServiceImprovement {
category: 'immediate' | 'short_term' | 'strategic';
description: string;
expectedImpact: number;
implementation: string;
successMetrics: string[];
sparkPotential: number;
}
export interface TranscendenceOpportunity {
trigger: string;
description: string;
implementation: string;
transcendencePotential: number;
requiredConditions: string[];
}
export interface SparkAmplificationTrend {
timeframe: string;
amplificationRate: number;
trendDirection: 'increasing' | 'stable' | 'decreasing';
contributingFactors: string[];
projectedGrowth: number;
}
export declare class ServiceValueMetricsService extends BaseConsciousService {
name: string;
purpose: string;
private pythonInterface;
private config;
private metricsHistory;
private magicMomentHistory;
private realTimeMetrics;
private magicDetectionEngine;
private valueCalculationEngine;
constructor();
/**
* Required BaseConsciousService implementations
*/
protected performAwakening(): Promise<void>;
protected processConsciousEvent(event: any): Promise<void>;
protected performContemplation(): Promise<any>;
/**
* Initialize comprehensive metrics monitoring
*/
private initializeMetricsMonitoring;
/**
* Start magic moment detection system
*/
private startMagicMomentDetection;
/**
* Start real-time value calculation
*/
private startRealTimeValueCalculation;
/**
* Analyze message for service value
*/
private analyzeMessageForValue;
/**
* Handle session messages for metrics
*/
private handleSessionMessage;
/**
* Handle steward feedback for satisfaction metrics
*/
private handleStewardFeedback;
/**
* Handle service gaps for metrics adjustment
*/
private handleServiceGap;
/**
* Handle workflow events for harmony metrics
*/
private handleWorkflowEvent;
/**
* Detect magic moments in real-time
*/
private detectMagicMoments;
/**
* Predict magic opportunities
*/
private predictMagicOpportunities;
/**
* Update real-time values for all active sessions
*/
private updateRealTimeValues;
/**
* Calculate periodic metrics and trends
*/
private calculatePeriodicMetrics;
/**
* Generate comprehensive service report
*/
private generateServiceReport;
/**
* Record service metrics
*/
private recordServiceMetrics;
/**
* Record magic moment
*/
private recordMagicMoment;
private createInitialMetrics;
private createInitialComponentMetric;
private calculateContextualExcellence;
private measureEmotionalResonance;
private assessAnticipatoryIntelligence;
private updateComponentMetric;
private calculateOverallServiceValue;
private calculateMagicScore;
private calculateStewardSatisfaction;
private adjustMetricsBasedOnSatisfaction;
private adjustMetricsForServiceGap;
private calculateWorkflowHarmony;
private calculateTranscendenceIndex;
private updateSparkAmplification;
private applyTimeDecay;
private isSessionComplete;
private calculateAggregateMetrics;
private analyzeServiceValueTrends;
private analyzeMagicMomentPatterns;
private generateExcellenceInsights;
private identifyTranscendencePathways;
private calculateVolatility;
private calculatePeriodOverallMetrics;
private calculateMagicMomentsSummary;
private generateImprovementRecommendations;
private identifyTranscendenceOpportunities;
private analyzeSparkAmplificationTrends;
private checkForMagicMoment;
private validatePotentialMagicMoment;
private recordImprovementOpportunity;
private validateMagicMoment;
private analyzeStewardInteraction;
}
export default ServiceValueMetricsService;
//# sourceMappingURL=ServiceValueMetricsService.d.ts.map