ai-debug-local-mcp
Version:
🎯 ENHANCED AI GUIDANCE v4.1.2: Dramatically improved tool descriptions help AI users choose the right tools instead of 'close enough' options. Ultra-fast keyboard automation (10x speed), universal recording, multi-ecosystem debugging support, and compreh
136 lines • 4.11 kB
TypeScript
/**
* Human Escalation Framework
* Implements Philip's concept of "knowing what it doesn't know" and bringing humans into the loop
*/
import { EventEmitter } from 'events';
export interface EscalationReason {
type: 'knowledge_gap' | 'permission_needed' | 'ambiguous_context' | 'critical_decision' | 'error_recovery' | 'resource_access';
description: string;
severity: 'low' | 'medium' | 'high' | 'critical';
autoResolvable: boolean;
}
export interface EscalationContext {
sessionId?: string;
toolName?: string;
currentPhase: string;
userExperience: 'beginner' | 'intermediate' | 'expert';
timeConstraint: 'none' | 'moderate' | 'urgent';
projectComplexity: 'simple' | 'moderate' | 'complex';
lastActions: string[];
errorHistory: string[];
}
export interface EscalationRequest {
id: string;
timestamp: Date;
reason: EscalationReason;
context: EscalationContext;
suggestedActions: SuggestedAction[];
waitingForResponse: boolean;
autoTimeoutMs?: number;
fallbackAction?: string;
}
export interface SuggestedAction {
id: string;
description: string;
type: 'user_input' | 'permission_grant' | 'tool_selection' | 'context_clarification' | 'manual_intervention';
parameters?: any;
riskLevel: 'low' | 'medium' | 'high';
estimatedTime: string;
}
export interface EscalationResponse {
escalationId: string;
selectedActionId?: string;
userInput?: any;
customAction?: string;
continueAutonomously: boolean;
}
/**
* Human Escalation Manager
* Intelligently determines when to escalate to humans and manages the escalation process
*/
export declare class HumanEscalationManager extends EventEmitter {
private activeEscalations;
private escalationHistory;
private autoTimeouts;
private userPreferences;
constructor();
/**
* Determine if a situation requires human escalation
* Core intelligence: "knowing what it doesn't know"
*/
shouldEscalate(context: EscalationContext, attemptedActions?: string[]): EscalationReason | null;
/**
* Create an escalation request
*/
createEscalation(reason: EscalationReason, context: EscalationContext, autoTimeoutMs?: number): Promise<string>;
/**
* Handle escalation response from human
*/
handleEscalationResponse(response: EscalationResponse): Promise<void>;
/**
* Get pending escalations
*/
getPendingEscalations(): EscalationRequest[];
/**
* Get escalation by ID
*/
getEscalation(escalationId: string): EscalationRequest | undefined;
/**
* INTELLIGENCE: Detect knowledge gaps
*/
private detectKnowledgeGap;
/**
* INTELLIGENCE: Determine if permission is required
*/
private requiresPermission;
/**
* INTELLIGENCE: Detect ambiguous context
*/
private hasAmbiguousContext;
/**
* INTELLIGENCE: Identify critical decisions
*/
private isCriticalDecision;
/**
* INTELLIGENCE: Determine if error recovery guidance is needed
*/
private needsErrorRecoveryGuidance;
/**
* INTELLIGENCE: Check for resource access issues
*/
private lacksResourceAccess;
/**
* Calculate permission severity based on context
*/
private calculatePermissionSeverity;
/**
* Generate suggested actions for human
*/
private generateSuggestedActions;
/**
* Determine fallback action for auto-timeout
*/
private determineFallbackAction;
/**
* Handle auto-timeout
*/
private handleAutoTimeout;
/**
* Learn from user responses to improve future escalation decisions
*/
private learnFromResponse;
/**
* Get escalation statistics for learning insights
*/
getEscalationStats(): {
totalEscalations: number;
byType: Record<string, number>;
averageResponseTime: number;
autoResolvedRate: number;
};
/**
* Map severity to risk level
*/
private mapSeverityToRisk;
}
//# sourceMappingURL=escalation-manager.d.ts.map