UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio

101 lines (100 loc) 2.79 kB
/** * HITL (Human-in-the-Loop) Manager * * Central orchestrator for all HITL confirmation workflows. * Manages user confirmation requests, timeouts, and argument modifications * for enterprise-grade AI safety. */ import { EventEmitter } from "events"; import type { HITLConfig, ConfirmationResult, HITLStatistics } from "../types/index.js"; /** * HITLManager - Central orchestrator for Human-in-the-Loop safety mechanisms * * Features: * - Real-time user confirmation via events * - Configurable dangerous action detection * - Custom rule engine for complex scenarios * - Argument modification support * - Comprehensive audit logging * - Timeout handling with cleanup */ export declare class HITLManager extends EventEmitter { private config; private pendingConfirmations; private statistics; constructor(config: HITLConfig); /** * Validate HITL configuration and apply defaults */ private validateConfig; /** * Check if a tool requires confirmation based on configuration */ requiresConfirmation(toolName: string, args?: unknown): boolean; /** * Request confirmation for a tool execution */ requestConfirmation(toolName: string, arguments_: unknown, context?: { serverId?: string; sessionId?: string; userId?: string; }): Promise<ConfirmationResult>; /** * Process user response to confirmation request */ processUserResponse(confirmationId: string, response: { approved: boolean; reason?: string; modifiedArguments?: unknown; responseTime?: number; userId?: string; }): void; /** * Handle confirmation timeout */ private handleTimeout; /** * Set up event handlers for processing responses */ private setupEventHandlers; /** * Generate unique confirmation ID */ private generateConfirmationId; /** * Generate human-readable action description */ private generateActionDescription; /** * Get keywords that triggered HITL */ private getTriggeredKeywords; /** * Log audit events for compliance and debugging */ private logAuditEvent; /** * Get current HITL usage statistics */ getStatistics(): HITLStatistics; /** * Get current configuration */ getConfig(): HITLConfig; /** * Update configuration (for dynamic reconfiguration) */ updateConfig(newConfig: Partial<HITLConfig>): void; /** * Clean up resources and reject pending confirmations */ cleanup(): void; /** * Check if manager is currently enabled */ isEnabled(): boolean; /** * Get count of pending confirmations */ getPendingCount(): number; }