@hivetechs/hive-ai
Version:
Real-time streaming AI consensus platform with HTTP+SSE MCP integration for Claude Code, VS Code, Cursor, and Windsurf - powered by OpenRouter's unified API
194 lines • 5.39 kB
TypeScript
/**
* Business Intelligence System - Advanced KPIs and business metrics
*
* Provides enterprise-grade business intelligence capabilities with real-time KPIs,
* strategic insights, and executive-level reporting for consensus pipeline analytics.
*/
export interface BusinessKPI {
id: string;
name: string;
description: string;
category: 'financial' | 'operational' | 'quality' | 'strategic' | 'customer';
unit: 'percentage' | 'currency' | 'count' | 'ratio' | 'time' | 'score';
currentValue: number;
previousValue: number;
targetValue: number;
trend: 'improving' | 'stable' | 'declining';
changePercentage: number;
thresholds: {
critical: {
min?: number;
max?: number;
};
warning: {
min?: number;
max?: number;
};
target: {
min?: number;
max?: number;
};
};
status: 'excellent' | 'good' | 'warning' | 'critical';
lastUpdated: string;
formula: string;
dataSource: string;
frequency: 'real-time' | 'hourly' | 'daily' | 'weekly' | 'monthly';
}
export interface StrategicInsight {
id: string;
title: string;
type: 'opportunity' | 'risk' | 'trend' | 'benchmark' | 'recommendation';
priority: 'low' | 'medium' | 'high' | 'critical';
summary: string;
description: string;
impact: string;
confidence: number;
evidencePoints: string[];
relatedKPIs: string[];
affectedAreas: string[];
recommendations: {
action: string;
timeline: string;
effort: 'low' | 'medium' | 'high';
expectedROI: string;
}[];
generatedAt: string;
validUntil: string;
tags: string[];
}
export interface BIDashboard {
id: string;
name: string;
description: string;
kpis: BusinessKPI[];
insights: StrategicInsight[];
summaryCards: {
title: string;
value: string;
trend: string;
color: 'green' | 'blue' | 'yellow' | 'red';
icon: string;
}[];
executiveSummary: {
overallHealth: 'excellent' | 'good' | 'concerning' | 'critical';
keyWins: string[];
keyRisks: string[];
immediateActions: string[];
strategicRecommendations: string[];
};
performanceIndicators: {
category: string;
score: number;
components: {
name: string;
score: number;
weight: number;
}[];
}[];
benchmarks: {
internal: {
period: string;
comparison: string;
};
industry: {
standard: string;
position: string;
};
competitive: {
ranking: string;
advantage: string;
};
};
generatedAt: string;
period: string;
autoRefresh: boolean;
refreshInterval: number;
}
export interface BenchmarkData {
category: string;
metric: string;
ourValue: number;
industryAverage: number;
industryBest: number;
percentile: number;
interpretation: string;
recommendedTarget: number;
}
export declare class BusinessIntelligenceService {
private kpis;
private insights;
private dashboards;
private benchmarks;
constructor();
/**
* Initialize core business KPIs
*/
private initializeCoreBKPIs;
/**
* Start business intelligence data collection
*/
private startBICollection;
/**
* Update all KPIs with current data
*/
updateAllKPIs(): Promise<void>;
/**
* Calculate individual KPI value
*/
private calculateKPIValue;
/**
* KPI calculation methods
*/
private calculateRevenuePerQuery;
private calculateConsensusEffectiveness;
private calculateCustomerSatisfaction;
private calculateOperationalEfficiency;
private calculateCostOptimization;
private calculateMarketCompetitiveness;
private calculateTechnologyInnovation;
private calculateRiskMitigation;
/**
* Calculate KPI status based on thresholds
*/
private calculateKPIStatus;
/**
* Generate strategic insights
*/
generateStrategicInsights(): Promise<void>;
/**
* Generate executive dashboard
*/
generateExecutiveDashboard(): Promise<BIDashboard>;
/**
* Calculate category score for performance indicators
*/
private calculateCategoryScore;
/**
* Calculate overall system health
*/
private calculateOverallHealth;
/**
* Update benchmark data
*/
private updateBenchmarks;
/**
* Public API methods
*/
getAllKPIs(): BusinessKPI[];
getKPIById(id: string): BusinessKPI | undefined;
getKPIsByCategory(category: BusinessKPI['category']): BusinessKPI[];
getCriticalKPIs(): BusinessKPI[];
getStrategicInsights(): StrategicInsight[];
getInsightsByPriority(priority: StrategicInsight['priority']): StrategicInsight[];
getBenchmarks(): BenchmarkData[];
getDashboard(id: string): BIDashboard | undefined;
getAllDashboards(): BIDashboard[];
forceKPIUpdate(): Promise<void>;
forceInsightGeneration(): Promise<void>;
}
/**
* Global business intelligence service instance
*/
export declare const globalBusinessIntelligence: BusinessIntelligenceService;
//# sourceMappingURL=business-intelligence.d.ts.map