import { EventEmitter } from "events"; import { OperationMode } from "../types/index.js"; export interface ConfirmationOptions { operation: string; filename: string; showVSCodeOpen?: boolean; content?: string; riskLevel?: 'low' | 'medium' | 'high' | 'critical'; permissionCategory?: string; contextInfo?: Record; } export interface ConfirmationResult { confirmed: boolean; dontAskAgain?: boolean; feedback?: string; } export interface PlannedOperation { id: string; timestamp: Date; operation: string; filename: string; content?: string; operationType: 'file' | 'bash'; riskLevel: 'low' | 'medium' | 'high' | 'critical'; executor?: () => Promise; } export declare class ConfirmationService extends EventEmitter { private static instance; private skipConfirmationThisSession; private pendingConfirmation; private resolveConfirmation; private pendingPlan; private planExecutionCallbacks; private sessionPermissions; static getInstance(): ConfirmationService; constructor(); requestConfirmation(options: ConfirmationOptions, operationType?: "file" | "bash"): Promise; confirmOperation(confirmed: boolean, dontAskAgain?: boolean): void; private inferCategory; private isPreApproved; private setGranularPermission; rejectOperation(feedback?: string): void; private openInVSCode; isPending(): boolean; resetSession(): void; getSessionFlags(): { fileOperations: boolean; bashCommands: boolean; allOperations: boolean; planMode: boolean; }; setSessionFlag(flagType: "fileOperations" | "bashCommands" | "allOperations" | "planMode", value: boolean): void; /** * Get the current operation mode based on session flags * Priority: planMode > allOperations > manual */ getCurrentMode(): OperationMode; /** * Set the operation mode * This properly configures both planMode and allOperations flags */ setMode(mode: OperationMode): void; /** * Cycle to the next mode: manual → plan → auto → manual */ cycleMode(): OperationMode; /** * Check if the service is currently in plan mode */ isInPlanMode(): boolean; /** * Check if plan mode is active and has pending operations */ isCollectingPlan(): boolean; /** * Check if the pending plan is empty */ isPlanEmpty(): boolean; /** * Get all pending operations in the plan */ getPlan(): PlannedOperation[]; /** * Get the count of pending operations */ getPlanLength(): number; /** * Add an operation to the pending plan * Returns false if not in plan mode, true if added successfully */ addToPlan(operation: string, filename: string, operationType: 'file' | 'bash', riskLevel: 'low' | 'medium' | 'high' | 'critical', content?: string, executor?: () => Promise): boolean; /** * Clear the pending plan without executing */ clearPlan(): void; /** * Execute all pending operations in the plan * Returns array of results */ executePlan(): Promise; /** * Get a summary of the plan for display */ getPlanSummary(): { total: number; byType: { file: number; bash: number; }; byRisk: Record; }; }