/** * Processing Feedback - Shows user feedback during LLM processing * * Listens to pipeline events and displays an animated spinner * so users know what's happening while the system is "thinking". */ import type { LoadedPlugin } from '../types/plugin.types.js'; /** * Context window usage tracking */ export interface ProcessingFeedbackOptions { /** Whether feedback is enabled */ enabled?: boolean; /** Show model name in feedback */ showModel?: boolean; /** Show stage information */ showStage?: boolean; } export declare class ProcessingFeedback { private activeLLMRequests; private activeParallelStages; /** Cumulative estimated cost across all LLM responses in this session (USD) */ private estimatedCostUsd; /** Context window usage tracking */ private contextWindow; private currentActivity; private currentGroup; private currentModel; private currentStage; private emitter; private enabled; private eventHandler; private groupDepth; private options; private phraseIndex; private phraseInterval; /** Session info for displaying execution mode */ private sessionInfo; private spinnerFrame; private startTime; private statusBarInterval; private statusBarVisible; constructor(options?: ProcessingFeedbackOptions); /** * Start listening for pipeline events and showing feedback */ start(): void; /** * Stop listening and clean up */ stop(): void; /** * Handle pipeline events */ private handleEvent; /** * Handle pipeline start - capture initial context and session info */ private handlePipelineStart; /** * Handle stage start - print group header with active indicator */ private handleStageStart; /** * Print initial group header directly (for active states, will be animated by drawStatusBar) */ private printGroupHeaderDirect; /** * Draw horizontal separator line before status bar */ private drawSeparatorLine; /** * Check if any parallel stages are currently active * Buffer messages when any parallel stage is active to prevent interleaved output */ private isInParallelMode; /** * Print content above the status bar, routing to the correct stage */ private printAboveStatusBar; /** * Print a single line above the status bar (immediate output) */ private printLineAboveStatusBar; /** * Flush buffered messages for a stage (prints all messages as a block) */ private flushStageMessages; /** * Show the fixed status bar at the bottom */ private showStatusBar; /** * Hide the status bar */ private hideStatusBar; /** * Draw/update the status bar */ private drawStatusBar; /** * Draw only the status bar text (without updating group headers) * Draws 2 lines: status bar (line 1) and context insights (line 2) * Cursor is expected to be on context insights line and remains there after drawing */ private drawStatusBarOnly; /** * Build the status bar parts array * Note: Token count and context indicator are shown in the context insights line below */ private buildStatusBarParts; /** * Build the context insights line showing detailed token usage * Format: Context: 48,880/200,000 tokens (24% used) | In: 29,817 | Out: 19,063 | Remaining: 151,120 */ private buildContextInsightsLine; /** * Determine utilisation level based on percentage thresholds */ private getUtilizationLevel; /** * Get the session mode indicator for the status bar * Returns a colored indicator showing whether running live or from session */ private getSessionModeIndicator; /** * Update the current activity shown in status bar */ private setActivity; /** * Handle LLM request - update status bar */ private handleLLMRequest; /** * Handle LLM response - update token count and context window usage */ private handleLLMResponse; /** * Accumulate estimated cost from a single LLM response event */ private accumulateLLMResponseCost; /** * Update context window usage tracking */ private updateContextWindowUsage; /** * Update token count for a stage */ private updateStageTokenCount; /** * Update estimated cost for a stage */ private updateStageCost; /** * Print the indented completion summary line for a finished stage */ private printStageCompletionSummary; /** * Handle stage complete - update state and clean up */ private handleStageComplete; /** * Handle stage error */ private handleStageError; /** * Handle pipeline complete */ private handlePipelineComplete; /** * Handle pipeline error */ private handlePipelineError; /** * Stop phrase rotation */ private stopPhraseRotation; /** * Get elapsed seconds since start */ private getElapsedSeconds; /** * Format elapsed time as "1h 5m 30s" or "5m 30s" or "30s" */ private formatElapsedTime; /** * Reset internal state */ private reset; /** * Enable or disable feedback */ setEnabled(enabled: boolean): void; /** * Check if feedback is enabled */ isEnabled(): boolean; /** * Check if spinner is currently active */ isSpinnerActive(): boolean; /** * Check if currently inside a group (stage) */ private isInsideGroup; /** * Get indent string - only indent if inside a group */ private getIndent; /** * Get the current active stage (most recently started) */ private getCurrentActiveStage; /** * Check if this is the first child message for a stage * and increment the child count. * In parallel execution, the stagePath should be provided to track correctly. */ private isFirstChildMessage; /** * Show a status message - updates the status bar activity */ showStatus(message: string): void; /** * Show an info message (gray indicator, white text, dim metadata) */ showInfo(message: string, data?: Record): void; /** * Show a warning message (yellow indicator, white text, dim metadata) */ showWarn(message: string, data?: Record): void; /** * Show an error message (red indicator, red text, dim context) */ showError(message: string, data?: Record): void; /** * Show a success message (green indicator, grey text) */ showSuccess(message: string): void; /** * Show a completed/done message (grey text) */ showDone(message: string): void; /** * Show an action being performed (white indicator, grey text) */ showAction(action: string, target?: string): void; /** * Start a new message group (e.g., for a pipeline or stage) */ startGroup(name: string): void; /** * End the current message group */ endGroup(): void; /** * Priority fields to show in data details (in order of preference) */ private static readonly PRIORITY_FIELDS; /** * Format data details for display * Extracts the most relevant fields from the data object */ private formatDataDetails; /** * Extract formatted values for priority fields */ private extractPriorityFields; /** * Extract formatted values for non-priority fields as fallback */ private extractFallbackFields; /** * Format a single value for display */ private formatValue; /** * "confidence" is logged on two different scales across the codebase: 0-1 (task * classification, agent selection) and 0-100 (escalation signals). A 0-1 score is by * definition never greater than 1, so anything above that is already a percentage — * scale up only the former to avoid double-scaling the latter (e.g. 74 -> "7400%"). */ private formatConfidencePercent; /** * Format a list of tool names, truncating to MAX_TOOLS_LIST_LENGTH characters */ private formatToolsList; /** * Check if running in MCP mode */ private isMcpMode; /** * Show loaded plugins at startup — mirrors showMCPStatus layout */ showPluginsStatus(plugins: LoadedPlugin[]): void; /** * Show MCP availability status * Displays a summary of available and unavailable MCP servers */ showMCPStatus(results: Array<{ error?: string; name: string; riskLevel?: string; serverId: string; status: 'connection_failed' | 'disabled' | 'not_configured' | 'not_installed' | 'ready'; toolCount?: number; }>): void; /** * Get human-readable reason for MCP status */ private getMCPStatusReason; /** * Show MCP tool call result */ showMCPToolCall(serverId: string, toolName: string, success: boolean, durationMs?: number): void; } /** * Get the singleton processing feedback instance */ export declare function getProcessingFeedback(): ProcessingFeedback; /** * Set a custom processing feedback instance */ export declare function setProcessingFeedback(feedback: ProcessingFeedback): void; //# sourceMappingURL=processing-feedback.d.ts.map