/** * Human-in-the-Loop (HITL) System * Pauses AI execution and prompts users for important decision paths * This is the ONLY HITL system in the repository */ import { EventEmitter } from 'node:events'; /** * Module-level event bus that fires when a HITL prompt opens or closes. Other * subsystems subscribe to: * - pause their own run-timeouts so user think-time doesn't abort the agent * (see AgentController), * - hand the terminal off cleanly so the prompt and post-prompt I/O don't * fight (see UnifiedUIRenderer / interactiveShell). * * Always paired: every `prompt-open` is followed by exactly one `prompt-close`, * including on timeout, Ctrl+C, custom-input, and shutdown paths. */ export declare const hitlEvents: EventEmitter; export declare function isHITLPromptActive(): boolean; export interface DecisionOption { id: string; label: string; description: string; shortcut?: string; } export interface DecisionRequest { id: string; title: string; description: string; context: string; options: DecisionOption[]; defaultOptionId?: string; requiresExplicitChoice: boolean; metadata?: Record; } export interface DecisionResponse { requestId: string; selectedOptionId: string; userInput?: string; timestamp: Date; } export interface HITLConfig { /** * Whether to automatically pause execution for decisions * If false, decisions will be logged but execution continues */ autoPause: boolean; /** * Timeout in milliseconds before auto-proceeding with default * 0 means no timeout (wait indefinitely) */ timeoutMs: number; /** * Default option to choose if timeout occurs */ timeoutDefaultOptionId?: string; /** * Log level: 'none' | 'minimal' | 'detailed' */ logLevel: 'none' | 'minimal' | 'detailed'; } export declare class HITLSystem { private config; private pendingDecisions; private decisionHistory; private rl?; constructor(config?: Partial); /** * Request a human decision * @returns Promise that resolves with the selected option ID */ requestDecision(request: DecisionRequest): Promise; /** * Present decision to user and wait for input using interactive arrow-key selection */ private promptUserForDecision; private cleanupReadline; private getOptionLabel; private logDecisionRequest; private recordDecision; /** * Get decision history */ getHistory(): DecisionResponse[]; /** * Clear decision history */ clearHistory(): void; /** * Update configuration */ updateConfig(config: Partial): void; } /** * Get the global HITL instance */ export declare function getHITL(config?: Partial): HITLSystem; /** * Helper function for common decision patterns */ export declare const hitl: { /** * Request a yes/no decision */ askYesNo(title: string, description: string, context?: string, defaultYes?: boolean): Promise; /** * Request selection from multiple options */ selectOption(title: string, description: string, options: Array<{ id: string; label: string; description: string; }>, context?: string, defaultOptionId?: string): Promise; /** * Request approval for a risky operation */ requestApproval(title: string, riskDescription: string, operationDetails: string): Promise; }; //# sourceMappingURL=hitl.d.ts.map